Skip to content

docs(tests): tighten the shared test-support prose from the post-sweep merges (#719) - #1074

Merged
JarryShaw merged 1 commit into
mainfrom
docs/719-final-tests-support
Oct 6, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
docs/719-final-tests-support

Conversation

@JarryShaw

@JarryShaw JarryShaw commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Please follow the guide below

What is the purpose of your pull request?

  • fix — corrects a defect
  • feat — adds a feature
  • perf — changes performance, not behaviour
  • refactor — changes neither behaviour nor performance
  • test — tests only
  • docs — documentation only
  • ci — workflows or build tooling
  • chore — anything else

Description of your pull request and other information

Final #719 pass over the prose ef0964c81..main added to tests/ outside protocols/, foundation/, corekit/, project/. Comments and docstrings only.

  • reimport_once_per_class: the unittest "import left in place" claim now excludes restore=True, which restores the region at class end; timed wording cut.
  • time_limit / conftest.pytest_timeout_cancel_timer: CI-history sentences cut; the measurements that justify them stay.
  • test_compat: "purged and restored around every test" and "registered before anything else" were stale after the per-class switch.
  • test_const_enum_lookup: two classes purge in setUpClass, not setUp.
  • _DUNDER_SAMPLE_SIZE is a stride divisor (~50 members of TCP/UDP, all of SCTP/DCCP), not a stride.
  • EndToEndTestCase.setUpClass: the claim that restore_module_table snapshots right after it was false. Under pytest the fixture restores the warm session pin before every test, so the purge and re-import never reach the tests (measured by id(sys.modules['pcapkit'])); the once-per-class rationale is now scoped to plain unittest. _pin_module_snapshot's opening now states the current contract, and pytest_sessionstart no longer claims the reload saves ~45s or that a reimporting class keeps its import.
  • "used to" / "since tests: stop re-importing pcapkit before every test (purge_modules dominates suite time) #1065" / "merged from" history cut in _helpers, builtin_parity, no_mint, registry_protocol.

Numstat: 9 files, +81/-96. Tests: each touched module, every EndToEndTestCase module, in its own pytest process, plus tests/project (375 passed, 1 skipped).

file (AST without docstrings vs origin/main) equal
tests/_support.py True
tests/conftest.py True
tests/const/test_const_apptype_split_unit.py True
tests/const/test_const_enum_builtin_parity.py True
tests/const/test_const_enum_lookup.py True
tests/const/test_const_enum_no_mint.py True
tests/const/test_const_registry_protocol.py True
tests/integration/_helpers.py True
tests/utilities/test_compat.py True

@JarryShaw JarryShaw added docs Pull requests that change documentation only (docs: subject prefix) review: pending No verdict for the current head - never reviewed, or the head moved since the last one labels Oct 6, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 6, 2026
@JarryShaw
JarryShaw force-pushed the docs/719-final-tests-support branch from 7ea2079 to 7ec132a Compare October 6, 2026 13:41
@JarryShaw
JarryShaw force-pushed the docs/719-final-tests-support branch from 7ec132a to f9ca0e6 Compare October 6, 2026 13:43
@JarryShaw JarryShaw added review: running A cross-review is in flight against the current head - no verdict yet and removed review: pending No verdict for the current head - never reviewed, or the head moved since the last one labels Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Coverage: 88.74% (unit tier, Python 3.14, f9ca0e627, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 4 93.55%
pcapkit/const 18757 1035 2342 846 90.23%
pcapkit/corekit 1874 91 578 22 94.33%
pcapkit/dumpkit 136 0 40 0 100.00%
pcapkit/foundation 2422 143 842 34 92.62%
pcapkit/interface 112 7 40 5 92.11%
pcapkit/protocols 15653 187 3942 162 98.19%
pcapkit/toolkit 487 71 144 3 84.15%
pcapkit/utilities 429 4 122 4 98.55%
pcapkit/vendor 4409 2359 1006 158 42.84%

Per-file detail: the coverage-html artifact of this run.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Cross-review verdict on f9ca0e627: GOOD TO GO (ran on Sonnet; author Opus)

  • No code changed: all 9 files are AST-identical to origin/main, and every hunk is a comment or docstring.
  • EndToEndTestCase.setUpClass behaves as the new docstring says, re-measured on both runners:
    • under pytest, tests see the pcapkit object from before setUpClass, which is the session pin;
    • under unittest, they see the one setUpClass imported.
  • pytest_sessionstart: it imports pcapkit and then pins, so the pin is warm (329 modules). A module held by a direct reference survives a restore.
  • reimport_once_per_class with restore=True vs default: confirmed by probe.
  • Sampling counts in tests/const:
    • TCP and UDP use a stride divisor of 128 and 127, giving about 50 evenly spaced members plus the aliased ones;
    • SCTP takes all 91 members and DCCP all 10;
    • neither SCTP nor DCCP has aliases.
  • The two setUpClass purgers in test_const_enum_lookup: confirmed.
  • The dropped 45s and 0.7s/92/28 figures were unfounded: the saving no longer exists, and the tree has 25 classes and 83 tests.
  • Touched modules pass, plus two integration modules.
  • Nit: tests/conftest.py:75 is 122 characters.
  • Not checked by the reviewer: tests/test_support_helpers.py, tests/project and test_const_enum_no_mint.py. The author's runs gave 32 passed and 375 passed, 1 skipped, and CI is green.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 6, 2026
@JarryShaw
JarryShaw merged commit 420aa91 into main Oct 6, 2026
40 checks passed
@JarryShaw
JarryShaw deleted the docs/719-final-tests-support branch October 6, 2026 15:51
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Pull requests that change documentation only (docs: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant