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/corekit/test_fields_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ def subclasses(cls: 'Any') -> 'Any':
fell_back = [] # type: list[str]
total = 0
for cls in set(subclasses(Schema)):
# Only this package's own declarations: a test that builds a schema
# of its own leaves it among the subclasses for as long as the
# import lives, and that is no longer one import per test (#1065).
# Only this package's own declarations: a schema a test builds for
# itself stays among the subclasses for as long as the import lives,
# and the whole class shares one import (#1065).
if cls.__module__.split('.')[0] != 'pcapkit':
continue
for name, field in getattr(cls, '__fields__', {}).items():
Expand Down
9 changes: 4 additions & 5 deletions tests/corekit/test_fields_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,10 @@ def setUp(self) -> None:
self.FieldValueError = FieldValueError
self.ceiling = field_module._MAX_ZERO_PAD_LENGTH

# The ledger is cumulative per context, so whatever ran earlier in this
# process -- a sibling class, another module -- has already earned
# allowance against it. Start every test from the unset default, as a
# freshly imported module would, rather than relying on a re-import per
# test to do it (GitHub issue #1065).
# The ledger is cumulative per context, and this class's tests share one
# import of the module, so an earlier test has already earned allowance
# against it. Start every test from the unset default, as a freshly
# imported module would (GitHub issue #1065).
token = field_module._zero_pad_ledger.set(None)
self.addCleanup(field_module._zero_pad_ledger.reset, token)

Expand Down
4 changes: 2 additions & 2 deletions tests/foundation/registry/test_foundation.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ def test_registration_accepts_pcapkit_own_builtin_classes(self) -> None:
# path instead of the public wrappers. The subject classes and the read-back
# are unchanged.
#
# NOTE: imported inside the test because ``setUp`` swaps in a fresh ``pcapkit`` in
# ``sys.modules``, which is why every sibling test imports locally too.
# NOTE: imported inside the test because ``setUp`` puts the class's own ``pcapkit``
# import in ``sys.modules``, which is why every sibling test imports locally too.
# ``Extractor`` is needed by name here so the registries can be read back.
from pcapkit.foundation.engines.pcap import PCAP as PCAP_Engine
from pcapkit.foundation.extraction import Extractor
Expand Down
9 changes: 4 additions & 5 deletions tests/foundation/test_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,10 @@ def setUp(self) -> None:

# Several tests here register into the four registries for real --
# overwriting ``json``, ``dpkt``, ``ipv4`` and ``tcp`` with stand-ins,
# or adding ``unit-*`` names -- so each table is put back in place
# afterwards. A fresh import per test used to do that implicitly; without
# it, a later extraction ran the stand-in engine and hung, and
# :mod:`tests.interface.test_core` found engines it has no constant for
# (GitHub issue #1065).
# or adding ``unit-*`` names -- and the class shares one import, so each
# table is put back afterwards. Without that, a later extraction ran the
# stand-in engine and hung, and :mod:`tests.interface.test_core` found
# engines it has no constant for (GitHub issue #1065).
for table in (Extractor.__output__, Extractor.__engine__,
Extractor.__reassembly__, Extractor.__traceflow__):
self.addCleanup(lambda table=table, saved=dict(table): (table.clear(), table.update(saved)))
Expand Down
Loading