Repository navigation
test(corekit): test_sentinel_exports_unit passes in the corekit unittest leg - #1386
Conversation
|
Cross-review verdict on
Fix: take Held up:
|
…est leg (#1332) The module bound the four sentinels at import time, so once an earlier module in the leg re-imported pcapkit, assertIs compared a stale object against the canonical one (5 failures). - Re-import once per class via tests._support.reimport_once_per_class. - Read the sentinels and BytesField inside each test; no assertion changed.
d02df66 to
fc7584e
Compare
|
Round-2 verdict on The author reran the mutation proof. Giving |
|
Coverage: 88.97% (unit tier, Python 3.14,
Per-file detail: the |
make pylint/mypy/isort)make testpasses — ran onlytests/corekit/test_sentinel_exports_unit.py(pytest) andutil/run_unittest_leg.py corekitWhat is the purpose of your pull request?
test— tests onlyCloses #1332
test_sentinel_exports_unit.pybound the four sentinels at import, so once an earlier module re-importedpcapkit,assertIscompared a stale object with the canonical one. Fix: classes callreimport_once_per_classinsetUp, and the sentinels andBytesFieldare read inside each test. No assertion is weakened;assertIsstays an identity check.Before / after (
util/run_unittest_leg.py corekit, file-size capped):593 tests, 5 failures->622 tests, 0 failures, 0 errors. Module alone under pytest:19 passed, 28 subtests passed. The original module fails 5/5 when run aftertest_fields_collectionsalone, so the new one is the one that holds.Polluter. Any earlier module that calls
reimport_once_per_classre-importspcapkitand leaves it in place under plain unittest. The first in leg order istests/corekit/test_fields_collections.py:25(setUp), which reachespurge_modules(['pcapkit'])attests/_support.py:970. Bisected one module at a time: all oftest_fields_*(excepttest_fields_misc_schema_length_1148_unit),test_from_dict_roundtrip_unit,test_infoclass,test_io,test_module,test_multidicttrigger it; thetest_enum_*,test_protochain*modules do not. This is the helper working as designed (#981), so the stale binding was the sentinel module's fault.