Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/protocols/internet/test_ipv6_ext_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ def test_overrun_warns_and_stops_instead_of_clipping(self) -> None:

def test_index_raises_because_no_class_level_identity_exists(self) -> None:
"""The fallback has no class-level identity, so it keeps raising rather
than being handed a placeholder index. This is also the other half of
the #917 contract in :class:`IPv6ExtSharedBaseContractTests`, which
relies on this test rather than repeating it.
than being handed a placeholder index.
:class:`IPv6ExtSharedBaseContractTests` relies on this test for that
half of the #917 contract.
"""
from pcapkit.protocols.internet.ipv6_ext import IPv6_Ext
from pcapkit.utilities.exceptions import UnsupportedCall
Expand Down
3 changes: 1 addition & 2 deletions tests/protocols/misc/test_pcapng_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3910,8 +3910,7 @@ class PCAPNGTruncatedFileTests(unittest.TestCase):

#: The result of :meth:`_sweep`, computed by the first test that asks for it
#: and shared by the other three: one extraction per octet of the sample is
#: the cost of this class, and every test reads the same result (GitHub
#: issue #1062).
#: this class's whole cost (GitHub issue #1062).
_swept = None # type: tuple[dict[int, int], dict[int, BaseException]] | None

@classmethod
Expand Down
10 changes: 6 additions & 4 deletions tests/protocols/schema/test_schema_metaclass_abc_cache_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ class was reading and writing the same ``isinstance`` cache that

def setUp(self) -> None:
# Fresh :mod:`pcapkit` classes *and* a freshly reset
# :mod:`collections.abc` cache -- :func:`purge_modules` does both, and
# both matter: a stale positive cache entry left over from an earlier
# test in the same process would make the very first assertion below
# true for the wrong reason.
# :mod:`collections.abc` cache, for every test. Both matter: a stale
# positive cache entry left over from an earlier test in the same
# process would make the very first assertion below true for the wrong
# reason. :func:`reimport_once_per_class` resets the cache each time;
# the classes are fresh each time only because ``tearDown`` purges them
# before :func:`reimport_once_per_class` can keep them for the next test.
reimport_once_per_class(self)

def tearDown(self) -> None:
Expand Down
10 changes: 5 additions & 5 deletions tests/protocols/test_dispatch_reachability_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ def __index__(cls) -> 'Any':
self.assertTrue(any(name.endswith('Unreachable') for name in names),
f'audit missed the injected gap; reported {names}')
finally:
# ``__subclasses__`` holds a weak reference, but the class is only
# collected once nothing in this frame names it -- and, a class
# being a reference cycle of its own, once the cycle collector has
# run. Until then the next audit in the same import still sees it
# (GitHub issue #1065: no longer one import per test).
# ``__subclasses__`` holds a weak reference, but a class is a
# reference cycle of its own, so it is only collected once nothing
# in this frame names it *and* the cycle collector has run. Until
# then the next audit on the class's shared import still sees it
# (GitHub issue #1065).
del Unreachable
gc.collect()

Expand Down
6 changes: 3 additions & 3 deletions tests/protocols/test_dispatch_registry_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ class DispatchRegistryTests(unittest.TestCase):
"""One dispatch probe per entry across all seven ``__proto__`` registries."""

#: The generator module, loaded once for the whole class. Loading it
#: imports :mod:`pcapkit`, so it must happen after :meth:`setUp` has purged
#: the previous test's copy -- hence a class attribute filled in
#: :meth:`setUpClass` rather than a module-level import.
#: imports :mod:`pcapkit`, so it must happen after the purge in
#: :meth:`setUpClass` -- hence a class attribute filled in there rather
#: than a module-level import.
dispatch = None # type: Any

@classmethod
Expand Down
6 changes: 3 additions & 3 deletions tests/protocols/test_option_roundtrip_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,9 @@ class OptionRoundTripTests(unittest.TestCase):
"""One construct -> parse -> construct cycle per registered code."""

#: The generator module, loaded once for the whole class. Loading it imports
#: :mod:`pcapkit`, so it must happen after :meth:`setUp` has purged the
#: previous test's copy -- hence a class attribute filled in
#: :meth:`setUpClass` rather than a module-level import.
#: :mod:`pcapkit`, so it must happen after the purge in :meth:`setUpClass`
#: -- hence a class attribute filled in there rather than a module-level
#: import.
options = None # type: Any

@classmethod
Expand Down
Loading