Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: cli tester #32

Merged
merged 4 commits into from
Aug 26, 2024
Merged

feat: cli tester #32

merged 4 commits into from
Aug 26, 2024

Conversation

jaykv
Copy link
Owner

@jaykv jaykv commented Aug 26, 2024

  • New tests section added in manifest
  • New command to run CLIs tests with cli test <manifest path>

Summary by Sourcery

Add a new CLI command test to execute tests defined in a manifest, enhance the manifest schema to include a tests section, and introduce a Tester class to support CLI testing. Refactor the CLIManifestReloader to Reloader for improved code clarity.

New Features:

  • Introduce a new CLI command test to run tests defined in a manifest file, allowing users to execute and validate CLI commands through specified test scripts.

Enhancements:

  • Add a tests section to the CLI manifest schema to define command tests, enabling structured testing of CLI commands.
  • Refactor the CLIManifestReloader class to Reloader for a more generic implementation.

Tests:

  • Implement a new Tester class to facilitate the execution of CLI tests, including methods to invoke tests and validate command execution.

Copy link

sourcery-ai bot commented Aug 26, 2024

Reviewer's Guide by Sourcery

This pull request introduces a new CLI testing feature, including a new 'test' command and associated functionality. It also includes some refactoring and improvements to existing code.

File-Level Changes

Change Details Files
Introduced a new CLI testing feature
  • Added a new 'test' command to run tests defined in the manifest
  • Created a new Tester class to handle test execution
  • Added a 'tests' section to the CLI manifest structure
  • Implemented test result reporting with colored output
cliffy/cli.py
cliffy/manifests/v1.py
cliffy/tester.py
examples/hello.yaml
Refactored and improved existing code
  • Renamed CLIManifestReloader to Reloader for more general use
  • Moved import_module_from_path function from builder.py to helper.py
  • Added an optional parameter 'add_command_name_mapping' to Transformer class
cliffy/cli.py
cliffy/reloader.py
cliffy/builder.py
cliffy/helper.py
cliffy/transformer.py

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

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 @jaykv - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider more specific exception handling in the test function to avoid masking important errors.
  • The test output formatting could be improved for better readability, especially for failed tests.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟡 Security: 1 issue found
  • 🟡 Testing: 2 issues found
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

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 to tell me if it was helpful.

cliffy/cli.py Show resolved Hide resolved
cliffy/transformer.py Outdated Show resolved Hide resolved
cliffy/manifests/v1.py Show resolved Hide resolved
cliffy/tester.py Show resolved Hide resolved
cliffy/helper.py Show resolved Hide resolved
@jaykv jaykv merged commit aec263b into main Aug 26, 2024
@jaykv jaykv deleted the tester branch August 26, 2024 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant