Repository navigation
refactor(tests): improve test quality and remove test smells - #1141
Merged
25 commits merged intoNov 6, 2026
Merged
25 commits merged into
25 commits merged into
Conversation
…ional-test-logic refactor(tests): remove Conditional Test Logic occurrences
…est_embeddings.py, tests/test_search_quality.py, tests/test_watch_robustness.py
…n-test refactor(tests): remove Unknown Test occurrences
…ion-handling refactor(tests): simplify exception handling in tests
…e-test refactor(tests): remove Verbose Test occurrence
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are blocking this test-suite refactor.
No open issues 🎉
What changed in this PR
This PR refactors the test suite to make scenarios and expected outcomes clearer, without changing production code.
Changes:
- Replaces conditional checks with direct assertions, collection comparisons, and parametrized cases.
- Adds explicit outcome checks and simplifies exception assertions.
- Extracts setup helpers and improves database resource cleanup.
| File | Description |
|---|---|
| tests/test_watch_robustness.py | Verifies invalid paths leave the graph empty. |
| tests/test_tools.py | Strengthens flow filtering, truncation, and community assertions. |
| tests/test_token_budget.py | Requires nonempty affected flows without step lists. |
| tests/test_search_quality.py | Adds explicit search-result and mode assertions. |
| tests/test_python_relative_imports.py | Collects and validates path-shaped import targets. |
| tests/test_multilang.py | Simplifies parser assertions and exception handling. |
| tests/test_main.py | Parametrizes expected tool offloading behavior. |
| tests/test_import_scope.py | Checks the exact expected import targets. |
| tests/test_genai_packaging.py | Parametrizes locked-package source validation. |
| tests/test_export_formats.py | Simplifies YAML frontmatter validation. |
| tests/test_eval.py | Reuses repository, graph, and benchmark setup helpers. |
| tests/test_embeddings.py | Adds a removal assertion and explicit exception expectations. |
| tests/test_embedding_refresh.py | Extracts mocked MCP invocation setup. |
| tests/test_embedding_initialization.py | Extracts concurrent model-constructor setup. |
| tests/test_daemon.py | Extracts reconciliation setup and checks rejected writes preserve configuration. |
| tests/test_cpp_overload_identity.py | Extracts reindexing and edge-lookup helpers. |
| tests/test_concurrency_and_daemon.py | Extracts migration database and rapid file-change setup. |
| tests/test_communities.py | Extracts sparse-graph and community-splitting scenarios. |
| tests/test_cli.py | Simplifies exit assertions and extracts repository setup. |
| tests/test_changes.py | Requires multiple priorities and verifies descending risk order. |
| tests/test_call_site_provenance.py | Uses temporary-path and context-managed migration setup. |
| tests/test_auto_promote.py | Validates workflow step references as a set. |
| tests/test_agent_transparency.py | Extracts Java qualified-name graph setup. |
Review effort: Balanced
0160eb0
gowrishacv
pushed a commit
to gowrishacv/code-review-graph
that referenced
this pull request
Nov 6, 2026
… (review of tirth8205#1141) Restores the comments that explain why tests are shaped as they are, puts the Portuguese comments into English, clears new ruff findings, names the bad pages again in the Obsidian YAML test, and reads uv.lock when the source guard runs rather than at collection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gowrishacv
pushed a commit
to gowrishacv/code-review-graph
that referenced
this pull request
Nov 6, 2026
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
This PR refactors test methods in the CodeReviewGraph test suite to address common test smells, improving readability, maintainability, and test clarity while aiming to preserve existing test behavior.
The refactorings were guided by the CATSPY catalog and validated using Pytest and TEMPY.
Changes
tests/test_genai_packaging.py,tests/test_tools.py,tests/test_changes.py, and others): Replaced conditional checks and loops with direct assertions, collection-based checks, and Pytest parametrization to make test scenarios more explicit.tests/test_embeddings.py,tests/test_search_quality.py, and others): Added explicit assertions to verify expected results instead of relying exclusively on the absence of exceptions.tests/test_cli.py,tests/test_embeddings.py, and others): Simplified exception-related test logic using clearer verification strategies.tests/test_communities.py,tests/test_eval.py,tests/test_concurrency_and_daemon.py, and others): Extracted reusable helper functions and reorganized lengthy tests to improve readability and reduce duplication.Validation
Notes
Changes are limited to the test suite. No production code or measurement artifacts are included in this PR.