[MRG] refactor(tests): remove test smells from the test suite #871
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 269 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.335
Real PR Conversation Timeline
1 comments
"Review active on #871"
general
weight: 0.35
bosd
Why
This PR refactors test smells in the test suite: patterns in test code that make tests harder to read, debug or trust, such as assertions that can never fail, loops and conditionals inside tests, and
try/exceptblocks that hide failures. The smells were detected with TEMPY and refactored following the CATSPY test smell catalog, as part of a Software Quality course assignment at the Federal University of Ceará (UFC), Brazil.Only files under
tests/are touched. No library code changes.Commits
1.
test: fix tests that could never fail-
test_pdfium_backend_import_errorandtest_import_erroronly asserted inside anexceptblock that never ran, becausepypdfium2andmatplotlibare already imported when camelot loads. They now simulate the failed import and assert on the result.-
test_cli_quietpassed--quietwithout a value, so Click consumed--formatas its value and the command exited with a usage error nobody checked. It now passes a value and asserts a clean exit with no warnings.2.
test: move test doubles to tests/doubles.py: the conversion backend stubs and theLTTextLinestub move out of the test modules.3.
test: replace try/except blocks with direct assertions:test_no_tables_found_*no longer catch the warning they are meant to forbid, and the SQLite export tests usecontextlib.closingand check the exact table names.4.
test: replace loops and conditionals inside tests: loops over inputs become@pytest.mark.parametrize, an in-body skip becomesskipif, and a per-row assertion loop becomes one assertion that lists every bad row.5.
test: split the long CLI stream and output format tests: one test per behaviour, so the first failure no longer hides the rest.6.
test: tidy up two tests in test_errors.py: an emptypassstub gets a descriptive name and a docstring, andtest_extraction_not_allowedalso matches the error message.How it was tested
ruff check,ruff format --checkandmypy camelot testspass.