ci(unit-tests): install DPKT so the dpkt-gated tests actually run - #737
Conversation
`dpkt` was declared only in the `DPKT` and `all` extras (pyproject.toml), and no install line in unit-tests.yml named either -- `.[test]` for the `test` job, `.[test,Scapy]` for `integration` and `gate`. Every `@unittest.skipUnless(HAS_RUNTIME and HAS_DPKT, ...)` test therefore skipped on every job, every Python version, forever, and read as a pass in the summary line. AST-measured: 28 methods across 6 files, confirmed by running the affected selection before and after this change. Add `DPKT` to all three `pip install -e` lines (`test`, `integration`, `gate`), on every existing matrix leg rather than one representative leg: `dpkt` measured a clean install and import on 3.10-3.14, it adds no new job or leg (unlike Scapy, which already sets that precedent on the same lines), and the `test`/`integration` jobs already run their existing tiers across the full matrix, so singling out one leg for this extra would be an inconsistency, not a saving. `HAS_RUNTIME`'s four packages are core `project.dependencies`, already installed unconditionally, so the extra alone is sufficient. Verified with throwaway venvs (dpkt is never installed into the repo venv): before, the six files report 26 passed / 28 skipped + 6 passed / 3 skipped (28 dpkt-gated + 3 unrelated scapy/pyshark skips); after, 62 passed / 1 skipped (only the unrelated pyshark skip remains).
|
✅ GOOD TO MERGE @ |
|
✅ GOOD TO MERGE @ Independent cross-review on a different model from the author. Every figure below is one I obtained myself, not one taken from the PR body.
On the matrix legs I agree with all five, not one. #715 was job count (~130 min/push of duplicated legs); this adds no job, and a 194 kB pure-Python wheel costs about a second per leg. Measured wall-clock stays inside pre-existing variance ( Caveats and disagreements, none blocking:
✅ GOOD TO MERGE @ |
…aches it #729 and #738 were one defect twice: a HAS_*-gated suite whose dependency no CI job installs, skipping silently because `pytest -q` prints no skip reasons. #737 and #740 fixed the install lines; nothing held them there. - tests/_dependency_gates.py derives per flag: its gates (AST over class- AND method-level skipUnless), the pytest-running jobs reaching them (_tiers' is_unit_tier / fixture_tier_paths, at node-ID granularity), and whether that job's install line carries an extra providing it. Extras come from pyproject.toml; only import-name -> distribution is hand-written. - Seven known gaps carry a reason each in DEPENDENCY_GATE_EXCLUSIONS; an entry that outlives its gap fails, since declared must equal derived, both ways. - New: HAS_RUNTIME in test_runtime_engines.py also wants dpkt/scapy/pyshark, so 5 methods skip on `test` and `gate`. Absent from #738. Tracked in #751. - Corrects #745 and #738: HAS_CRAWLER_DEPS is not dark (`test` has carried requests and bs4 since #507); HAS_VENDOR_DEPS lacks only html5lib; HAS_PYPCAPFILE gates 15 methods, not 10 (#747 grew the class 4 -> 9). 37 -> 84 tests in tests/test_tier_guard.py under plain unittest; 98% branch coverage of the new module. Deleting `crypto` from the `test` job's install line in a scratch copy makes the guard fail, naming all 14 ESP gates. Fixes #745.
Please follow the guide below
make pylint,make mypy,make isort) — N/A, YAML-only change, no Python touchedmake testpasses, and a test case covers the change — forbidden here (full suite); see test evidence below insteadWhat is the purpose of your pull request?
fixfeatperfrefactortestcichoreDescription
Fixes #729.
dpktis declared only in theDPKT/allextras; nounit-tests.ymlinstall line named it (.[test]fortest,.[test,Scapy]forintegration/gate), so allHAS_RUNTIME and HAS_DPKT-gated tests skipped on every job/version, forever, reading as passes.AST-measured (still accurate after #725/#731 shifted the issue's line numbers): 28 methods, 6 files — 20
test_dpkt_unit.py, 4test_misc.py, 1 eachtest_extraction.py/test_core.py/test_engine_parity.py/test_engine_runtime.py.Added
DPKTto all three install lines, on every existing leg (not one representative leg):dpkt1.9.8 installs and imports cleanly on 3.10–3.14 (measured, throwaway venvs), it adds no new job/leg — unlike Scapy, which already sets the "extra on every leg" precedent on these same lines — and singling out one leg would be an inconsistency, not a wall-clock saving (#715 is about job count, not per-job extras).HAS_RUNTIME's four packages are coreproject.dependencies, always installed already, soDPKTalone is sufficient — no separate fix needed there.test_reassembly_engine_parity.pyalso importsHAS_DPKTbut only branches internal assertions on it; it isn'tskipUnless-gated and isn't one of the 28.Test evidence (throwaway
/tmpvenvs, repo.venvnever touched;pcapkit.__file__confirmed pointing at this worktree): before (.[test]/.[test,Scapy], no dpkt): 26 passed/28 skipped + 6 passed/3 skipped. After (+DPKT): 62 passed, 1 skipped — the 1 remaining skip is an unrelatedpyshark not installed. All 28 previously-skipped dpkt methods now pass.