Skip to content

Exempt lifecycle and construction methods from test gaps (part of #850) - #854

Merged
1 commit merged into
tirth8205:mainfrom
asemraza:fix/test-gap-lifecycle-noise
Aug 19, 2026
Merged

Exempt lifecycle and construction methods from test gaps (part of #850)#854
1 commit merged into
tirth8205:mainfrom
asemraza:fix/test-gap-lifecycle-noise

Conversation

@asemraza

Copy link
Copy Markdown
Contributor

Addresses suggestion 1 of #850 (the noise part). The container-resolution linkage remains open there and in #851.

Problem

analyze_changes lists setUp, tearDown, __construct and friends as test gaps. These are exercised implicitly by every test touching their class, so they inflate the gap count and the Untested: summary line. In the report that motivated #850, 5 of the 6 gaps on a 2-file diff were lifecycle noise.

Change

A module-level _TEST_GAP_EXEMPT_NAMES frozenset (PHPUnit/xUnit and Python unittest lifecycle names plus constructors) checked in the test-gap loop. Deliberately name-based and conservative: migration up/down are NOT excluded here because bare names are too generic to exempt safely; ignore patterns handle migration dirs better.

Test

New test asserts lifecycle names and constructors stay out of test_gaps while a real uncovered method still appears. Full suite 2,399 passed, ruff and mypy clean.

setUp, tearDown, constructors and their xUnit/unittest variants are
exercised implicitly by every test that touches their class. Listing
them as test gaps inflates the gap count and pushes noise into the
Untested summary, which erodes trust in the panel for real gaps.

Partial fix; the container-resolution linkage itself is tracked in
issue 850 and in issue 851.

Part of tirth8205#850
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.

2 participants