tests/vendor/test_vendor_snapshot_restore_unit.py holds the same class of defect as #981: a stale
class generation captured before a sibling module purged and reimported pcapkit.
Symptom, under plain unittest with the directory's other modules in the same process:
FAIL: test_a_failure_leaves_the_previous_file_byte_for_byte_intact
(tests.vendor.test_vendor_snapshot_restore_unit.SnapshotRestoreTests)
AssertionError: VendorRuntimeWarning not triggered
with the warning visibly leaking to stderr one line earlier — it was raised, as a different
VendorRuntimeWarning object than the one assertWarnsRegex is matching against. The module alone
passes: Ran 4 tests in 0.179s ... OK. So it is genuinely order-dependent, not a broken test.
Why it needs its own issue. #984 adds a unittest-ordering CI leg to catch exactly this shape, and
excludes tests/vendor because of this test — so the one job built to see ordering defects is blind
to all 14 modules in that directory, and the finding currently lives only in a comment inside the matrix
entry that excludes it.
The fix is expected to be the same one-line importlib.import_module re-resolution #984 applies in
tests/test_base_class_contract.py — resolve the warning class in setUp rather than at import. Once
it lands, tests/vendor comes out of the exclusion list.
tests/corekit is a separate, pre-existing and documented case (5 identity subtests, per
purge_modules's own docstring) and is not in scope here.
tests/vendor/test_vendor_snapshot_restore_unit.pyholds the same class of defect as #981: a staleclass generation captured before a sibling module purged and reimported
pcapkit.Symptom, under plain
unittestwith the directory's other modules in the same process:with the warning visibly leaking to stderr one line earlier — it was raised, as a different
VendorRuntimeWarningobject than the oneassertWarnsRegexis matching against. The module alonepasses:
Ran 4 tests in 0.179s ... OK. So it is genuinely order-dependent, not a broken test.Why it needs its own issue. #984 adds a
unittest-orderingCI leg to catch exactly this shape, andexcludes
tests/vendorbecause of this test — so the one job built to see ordering defects is blindto all 14 modules in that directory, and the finding currently lives only in a comment inside the matrix
entry that excludes it.
The fix is expected to be the same one-line
importlib.import_modulere-resolution #984 applies intests/test_base_class_contract.py— resolve the warning class insetUprather than at import. Onceit lands,
tests/vendorcomes out of the exclusion list.tests/corekitis a separate, pre-existing and documented case (5 identity subtests, perpurge_modules's own docstring) and is not in scope here.