-
Notifications
You must be signed in to change notification settings - Fork 12
Refactor test fixtures with Claude #69
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
Conversation
Add CLAUDE.md for project guidelines Signed-off-by: Paul Zabelin <[email protected]>
crashes on any command chore: add ipykernel and ipython to dev dependencies Signed-off-by: Paul Zabelin <[email protected]>
Signed-off-by: Paul Zabelin <[email protected]>
but reading actual report files Signed-off-by: Paul Zabelin <[email protected]>
Signed-off-by: Paul Zabelin <[email protected]>
Signed-off-by: Paul Zabelin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- tests/snapshots/test_reporter/test_report_creates_correct_json/expected_report.json: Language not supported
Comments suppressed due to low confidence (1)
tests/test_runner.py:7
- [nitpick] Consider using a more specific type annotation for the 'reporter' parameter in dummy_test_function to clarify the expected interface, instead of using the generic 'object'.
def dummy_test_function(reporter: object) -> bool:
Signed-off-by: Paul Zabelin <[email protected]>
Signed-off-by: Paul Zabelin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.
Files not reviewed (1)
- tests/snapshots/test_reporter/test_report_creates_correct_json/expected_report.json: Language not supported
Comments suppressed due to low confidence (2)
tests/test_statistical_analysis.py:122
- [nitpick] The variable name 'csv' shadows the csv module and may lead to confusion. Consider renaming it to something like 'csv_output'.
csv = export_results_to_csv(results)
tests/test_statistical_analysis.py:159
- After saving the figure for snapshot comparison, there is no call to plt.close(), which might lead to resource warnings. Consider adding plt.close() to ensure proper cleanup.
snapshot.assert_match(buf.read(), "failure_rate_bar_graph.png")
Signed-off-by: Paul Zabelin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.
Files not reviewed (1)
- tests/snapshots/test_reporter/test_report_creates_correct_json/expected_report.json: Language not supported
Comments suppressed due to low confidence (2)
tests/test_runner.py:19
- [nitpick] Consider renaming the lambda parameter from 'x' to '_' to indicate that it is unused, ensuring consistency with other tests.
runner = Runner(test_function=lambda x: return_value, reporter=tmp_reporter)
tests/test_reporter.py:31
- [nitpick] Consider using the reporter_factory fixture for creating Reporter instances instead of manually setting parameters to maintain consistency across tests.
def test_report_creates_correct_json(test_name: str, snapshot: Any) -> None:
This pull request introduces several changes to improve testing, documentation, and dependency management in the codebase. The main changes include the addition of new fixtures for pytest, updates to the
CLAUDE.mdfile, and enhancements to theReporterclass tests.Documentation and Dependency Management:
CLAUDE.md: Added a new file with guidance for using Claude Code, including commands for installing dependencies, running tests, type checking, linting, and formatting, as well as code style guidelines.pyproject.toml: Addedipykernelandipythonto the development dependencies.Testing Enhancements:
tests/conftest.py: Introduced new pytest fixtures for creatingReporterinstances, analyzing failure rates, exporting results to CSV, and configuring matplotlib for consistent snapshot testing.tests/test_reporter.py: Updated tests to utilize the newreporter_factoryfixture and improved thetest_report_creates_correct_jsontest to verify metadata and output paths.tests/test_runner.py: Refactored tests to use thetmp_reporterfixture and added parameterized tests for running with environment variables. [1] [2] [3]Snapshot Testing and Statistical Analysis:
tests/snapshots/test_reporter/test_report_creates_correct_json/expected_report.json: Added a new snapshot file for verifying the JSON output of theReporterclass.tests/test_statistical_analysis.py: Refactored tests to use theanalyze_failure_ratefixture and improved the failure rate bar graph and graph tests for better snapshot consistency. [1] [2] [3] [4]