Skip to content

test: import pcapkit once per class in TCPHTTPDispatchTests - #2611

Merged
JarryShaw merged 1 commit into
mainfrom
test/2562-http-dispatch-test
Nov 2, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
test/2562-http-dispatch-test

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • test — tests only

Description of your pull request and other information

TCPHTTPDispatchTests.setUp now calls reimport_once_per_class(self) instead of purging pcapkit before every test. Its tests read TCP.__proto__ and parse fixed bytes, so none of them needs a fresh import. A deliberately broken dispatcher still fails the module.

test-coverage.rst's "Import once per class" bullet now records the per-test form: purge in setUp with a comment saying why, as ConstEnumRegisterFallbackTests does. It also names test_per_class_import_guard.py as the check that catches the helper being undone.

Open to the owner: should the rule that a per-test purge states its reason be enforced by extending test_per_class_import_guard? Recommended: leave it as a written rule for now.

Closes #2562

- TCPHTTPDispatchTests.setUp calls reimport_once_per_class(self) in place of
  a per-test purge_modules(['pcapkit']); its tests read TCP.__proto__ and
  parse fixed bytes, so none needs an import of its own.
- test-coverage.rst's "Import once per class" bullet records the per-test
  form: purge in setUp instead of calling the helper, with a comment saying
  why, as ConstEnumRegisterFallbackTests does, and names
  test_per_class_import_guard.py as the check on undoing the helper.
@JarryShaw JarryShaw added test Pull requests that add or correct tests (test: subject prefix) review: good-to-go Cross-review at the current head says ready; CI state is separate labels Nov 1, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at 5b3f9c4f4 (Sonnet review). The diff touches only tests and docs. A mutation check shows the module still catches a broken TCP→HTTP dispatch. It passes alone and in the plain-unittest protocols/application leg ordering.

@JarryShaw JarryShaw added test Pull requests that add or correct tests (test: subject prefix) review: good-to-go Cross-review at the current head says ready; CI state is separate labels Nov 1, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Coverage: 94.03% (unit tier, Python 3.15, 5b3f9c4f4, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 20093 144 2712 125 98.78%
pcapkit/corekit 2605 74 818 37 96.52%
pcapkit/dumpkit 281 3 100 3 98.43%
pcapkit/foundation 3360 27 1186 32 98.70%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 20346 220 5370 204 98.34%
pcapkit/toolkit 961 28 342 10 96.32%
pcapkit/utilities 506 7 144 5 98.15%
pcapkit/vendor 5009 2222 1148 182 52.31%

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

@github-actions github-actions Bot added this to the PyPCAPKit v1.6 milestone Nov 2, 2026
@JarryShaw
JarryShaw merged commit 20c8822 into main Nov 2, 2026
40 checks passed
@JarryShaw
JarryShaw deleted the test/2562-http-dispatch-test branch November 2, 2026 02:31
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Nov 2, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Nov 2, 2026
JarryShaw added a commit that referenced this pull request Nov 2, 2026
…s latest wave into 1.6.0 (#2449)

- Added: every whole HTTP/2 frame in a TCP segment is a further HTTPv2
  layer, the previous frame's payload, as with TLS (#2609).
- Folded into unreleased entries: SSLv3 lives in
  pcapkit.protocols.application.sslv3 (#2602), and a reassembled DTLS
  Datagram's packet holds the deferred handshake decode (#2605).
  tls.SSLv3 is in no release tag, so the entry records no move.
- Changed: the remaining xdist jobs at -n logical (#2606) join the CI
  entry, and the member-order entry cites the last reorder (#2613).
- No entry for the test-only #2611 and #2612, or for #2610's private
  registry sentinel, which changes no behaviour.
- CHANGELOG.md regenerated; util/changelog_md.py --check passes.
JarryShaw added a commit that referenced this pull request Nov 2, 2026
…6.0 (#2449)

- Folded into the TLS/DTLS entry: the hello and EncryptedExtensions
  extension lists, their registered body decoders, register_tls_extension
  and the pcapkit.const.tls extension types (#2595), and each whole DTLS
  record in a datagram as a further layer (#2603).
- The conventions entry records #2611's per-test purge rule; the
  member-order entry cites #2491.
- No entry for #2595's private ProtocolBase value helpers, as for the
  other private API.
- CHANGELOG.md regenerated; util/changelog_md.py --check passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Pull requests that add or correct tests (test: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

test: TCPHTTPDispatchTests purges pcapkit before every test, and test-coverage.rst records no per-test exception

1 participant