Refactor test fixtures with Claude#69
Merged
kseebaldt merged 9 commits intothisisartium:mainfrom Apr 7, 2025
Merged
Conversation
Add CLAUDE.md for project guidelines Signed-off-by: Paul Zabelin <paulzabelin@artium.ai>
crashes on any command chore: add ipykernel and ipython to dev dependencies Signed-off-by: Paul Zabelin <paulzabelin@artium.ai>
Signed-off-by: Paul Zabelin <paulzabelin@artium.ai>
but reading actual report files Signed-off-by: Paul Zabelin <paulzabelin@artium.ai>
Signed-off-by: Paul Zabelin <paulzabelin@artium.ai>
Signed-off-by: Paul Zabelin <paulzabelin@artium.ai>
Contributor
There was a problem hiding this comment.
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 <paulzabelin@artium.ai>
Signed-off-by: Paul Zabelin <paulzabelin@artium.ai>
Contributor
There was a problem hiding this comment.
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 <paulzabelin@artium.ai>
Contributor
There was a problem hiding this comment.
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 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.
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]