Skip to content

test: share the vendor crawler test helpers in tests/vendor/_crawler.py (#3148) - #3157

Merged
JarryShaw merged 1 commit into
developfrom
test/3148-e7-vendor-crawler
Nov 27, 2026
Merged

JarryShaw merged 1 commit into
developfrom
test/3148-e7-vendor-crawler

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

Please follow the guide below

  • Put an x into every box [ ] that applies to your pull request (like this: [x])

  • Use the Preview tab to see how your pull request will look

  • Searched for similar pull requests

  • Followed the coding style (make pylint, make mypy, make isort)

  • make test passes, and a test case covers the change

  • Described the user-visible change below and left its changelog entry to the maintainer, keeping docs/source/changelog/ and CHANGELOG.md out of the diff, if the change is user-visible: N/A — centralised

What is the purpose of your pull request?

Tick the commit type your subject line carries.

  • 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

  • release — bumps the version or rolls up a distribution

  • chore — anything else

  • Also tick if it regenerates constant or registry tables, members keeping their numeric values (the const label)


Description of your pull request and other information

Part of #3148 (batch E7, the vendor part of T17). The new tests/vendor/_crawler.py holds normalize, import_from_checkout, make_crawler, defined_crawlers and is_crawler. The batch's modules use them and keep every assertion (223 lines added, 540 removed).

Change Mutation proof (scratch copy, each turns the converted module red)
_normalize and the crawler setup in esp 2294, ieee802_11 2575, ipx packet and socket, radiotap 2576 and 2647, ipv6 925, mh 1848, reference formats 1664 esp rfcs tests text rather than bare; ieee Control renamed; ipx drops SPX, renames Unspecified; radiotap rewords the reserved-bit comment, renames BSS_COLOR; ipv6 renames IPv6-Route, and an empty count (the record that make_crawler sets); mh Wilcard; split_references keeps the RFC space
The checkout-guard setUp in ftp, reachability and dest_path, and _defined_crawlers ftp drops len(line) < 2; vendor.__all__ loses MH_HandoverInitiateStatus; _dest_path drops the const/ hop (191 subtests red)
test_const_enum_lookup takes normalize as _normalize, the name builtin_parity and #923 import from it the binding_ack_flag template back to return cls(value)

Kept local because their meaning differs: ftp's count(None) crawler, radiotap 2576's multi-page _assert_regenerates, the ipx no-network constructions, and each module's HAS_* gate (two or three deps, read per module by tests/_dependency_gates.py). Outside this batch: a further copy in test_vendor_llc_2936_unit.py, and an inline one in test_const_method_case_sensitive_896_unit.py.

Coverage: the coverage report for pcapkit/vendor/* (43%) and pcapkit/const/* (75%) is byte-identical before and after. Time: no saving. The per-module sum went from 70.1 s to 69.9 s and one -n 4 run from 17.9 s to 18.6 s, which is noise.
Tests: the batch modules (87 passed), tests/project (2494 passed), the root suites (266 passed), and the vendor and const unittest legs all pass.

…py (#3148)

- New tests/vendor/_crawler.py holds normalize(), the whitespace pass
  Vendor.__init__ writes a constant file through; import_from_checkout(),
  the skip unless the modules come from this checkout; make_crawler(), a
  crawler with NAME, DOCS and record set but no fetch or write; and
  defined_crawlers() and is_crawler(), the filesystem crawler discovery.
- The batch's vendor modules and test_const_enum_lookup drop their copies
  for them; every assertion stays. test_const_enum_lookup keeps the
  _normalize name, which test_const_enum_builtin_parity and the #923
  provenance test import from it.
- Copies whose meaning differs stay: ftp's count(None) crawler, radiotap's
  multi-page regeneration, the ipx no-network constructions, and each
  module's HAS_* dependency gate.

Tests: the touched modules, tests/project, the root suites and the vendor
and const unittest legs pass; coverage of pcapkit is unchanged.
@JarryShaw JarryShaw added test Pull requests that add or correct tests (test: subject prefix) review: pending No verdict for the current head - never reviewed, or the head moved since the last one labels Nov 27, 2026
@JarryShaw JarryShaw added this to the PyPCAPKit v1.9 milestone Nov 27, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Nov 27, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Good to go at c0cc365, from a Sonnet review.

  • All 10 replaced _normalize bodies have the same AST as the shared normalize.
  • make_crawler sets NAME, DOCS and record with the same calls as before, and the skip guards are no looser.
  • I re-ran four mutations (ipv6 count, _dest_path's const/ step, the reference-formats space, ftp's len(line) < 2), and each one turned red.
  • test_const_enum_builtin_parity and the provenance-923 test still import the _normalize shim and pass.
  • coverage report for pcapkit/vendor and pcapkit/const is byte-identical to develop's.
  • Test runs: tests/project 2494 passed, root 266 passed, the protocols sweeps 737 passed, and the vendor unittest leg is OK.
  • Not verified: the const unittest leg, though the same modules passed under pytest.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: pending No verdict for the current head - never reviewed, or the head moved since the last one labels Nov 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage: 94.79% (unit tier, Python 3.15, c0cc365ff, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 108 4 20 2 95.31%
pcapkit/const 21794 212 3100 185 98.32%
pcapkit/corekit 3059 83 1004 40 96.73%
pcapkit/dumpkit 423 3 148 5 98.60%
pcapkit/foundation 3919 24 1252 26 99.03%
pcapkit/interface 103 4 34 3 94.89%
pcapkit/protocols 26383 158 6952 129 99.13%
pcapkit/toolkit 994 26 356 8 96.74%
pcapkit/utilities 591 7 162 5 98.41%
pcapkit/vendor 6214 2320 1412 245 59.36%

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

@JarryShaw
JarryShaw merged commit 33a85c9 into develop Nov 27, 2026
40 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Nov 27, 2026
@JarryShaw
JarryShaw deleted the test/3148-e7-vendor-crawler branch November 27, 2026 22:18
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Nov 27, 2026
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.

1 participant