feat: add CLI options for test generator#839
Merged
Conversation
Reviewer's GuideThis 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
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
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-rootand--dry-runoptions - 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
There was a problem hiding this comment.
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.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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
generate_tests.pyTesting
pytest 02-ai-workspace/scripts/testspython 02-ai-workspace/scripts/generate_tests.py --dry-run --workspace-root 02-ai-workspace/scriptshttps://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:
Enhancements: