Skip to content

feat: add CLI options for test generator#839

Merged
Bryan-Roe merged 2 commits intomainfrom
uuxi0b-codex/initialize-agi-process
Aug 9, 2025
Merged

feat: add CLI options for test generator#839
Bryan-Roe merged 2 commits intomainfrom
uuxi0b-codex/initialize-agi-process

Conversation

@Bryan-Roe
Copy link
Collaborator

@Bryan-Roe Bryan-Roe commented Aug 9, 2025

Summary

  • add argparse-based CLI to generate_tests.py
  • allow specifying workspace root and a dry-run mode

Testing

  • pytest 02-ai-workspace/scripts/tests
  • python 02-ai-workspace/scripts/generate_tests.py --dry-run --workspace-root 02-ai-workspace/scripts

https://chatgpt.com/codex/tasks/task_e_6897a559679483228fc8c587a8027fc4

Summary by Sourcery

Add a command-line interface to generate_tests.py with options for specifying the workspace root and enabling a dry-run mode to preview test generation.

New Features:

  • Introduce argparse-based CLI to generate_tests.py
  • Add --workspace-root option to specify custom root directory for test generation
  • Add --dry-run option to preview test generation without writing files

Enhancements:

  • Default workspace root now resolves to the script's parent directory when not provided

Copilot AI review requested due to automatic review settings August 9, 2025 21:03
@sourcery-ai
Copy link

sourcery-ai bot commented Aug 9, 2025

Reviewer's Guide

This PR enhances generate_tests.py by refactoring TestGenerator to accept a configurable workspace root, adding a dry-run mode in test generation, and introducing an argparse-based CLI for specifying options.

File-Level Changes

Change Details Files
Refactored TestGenerator initialization to accept dynamic workspace_root
  • Changed init signature to workspace_root=None
  • Added docstring and logic to default to script's parent directory
02-ai-workspace/scripts/generate_tests.py
Introduced dry-run mode in generate_missing_tests
  • Added dry_run parameter and docstring
  • Adjusted loop to print dry-run messages instead of writing files
02-ai-workspace/scripts/generate_tests.py
Added argparse-based CLI for workspace-root and dry-run options
  • Created parse_args function with --workspace-root and --dry-run flags
  • Updated main to use parsed arguments and instantiate TestGenerator accordingly
02-ai-workspace/scripts/generate_tests.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds command-line interface capabilities to the test generator script, making it more flexible and user-friendly. The changes enable users to specify a custom workspace root directory and run in dry-run mode to preview what tests would be generated.

  • Added argparse-based CLI with --workspace-root and --dry-run options
  • Modified TestGenerator constructor to accept optional workspace_root parameter with intelligent defaults
  • Enhanced generate_missing_tests method to support dry-run mode for previewing changes

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Bryan-Roe - I've reviewed your changes - here's some feedback:

  • The generate_missing_tests method doesn’t return the generated_count but main expects a result—add a return of generated_count so the final summary is accurate.
  • The final print statement is dedented outside of the main function and will cause an indentation error—indent it properly within main.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The generate_missing_tests method doesn’t return the generated_count but main expects a result—add a return of generated_count so the final summary is accurate.
- The final print statement is dedented outside of the main function and will cause an indentation error—indent it properly within main.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Bryan <74067792+Bryan-Roe@users.noreply.github.com>
@Bryan-Roe Bryan-Roe merged commit 3d599a4 into main Aug 9, 2025
0 of 6 checks passed
@Bryan-Roe Bryan-Roe deleted the uuxi0b-codex/initialize-agi-process branch August 9, 2025 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant