From 28582b25c27e1b3740f0a113f65f6c93adb5dba0 Mon Sep 17 00:00:00 2001 From: Jarry Shaw Date: Thu, 24 Sep 2026 09:30:44 -0400 Subject: [PATCH] ci(unit-tests): install DPKT so the dpkt-gated tests actually run (#729) `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). --- .github/workflows/unit-tests.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 5325fa99f8..f0c57a3a58 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -73,10 +73,15 @@ jobs: python-version: ${{ matrix.python-version }} cache: pip + # The DPKT extra is here so the tests gated on it (test_dpkt_unit.py, + # test_misc.py, test_extraction.py, test_core.py) actually execute + # instead of skipping -- see #729. It is a small, pure-Python + # dependency (measured clean installs on 3.10-3.14), so it costs + # nothing per leg and adds no new job or leg, unlike Scapy below. - name: Install package and test dependencies run: | python -m pip install -U pip setuptools wheel - python -m pip install -e '.[test]' + python -m pip install -e '.[test,DPKT]' # `-n auto` resolves to whatever this runner reports, and nothing else in # the log says what that was -- print it so the number `-n auto` picked @@ -124,11 +129,14 @@ jobs: # The Scapy extra is there for examples/generators/pcap.py and legacy.py, # which build their captures with scapy; examples/generators/pcapng.py needs # nothing beyond the standard library and pcapkit itself, which it uses to - # parse each fixture back. + # parse each fixture back. DPKT joins it so the two dpkt-gated methods + # living under tests/integration/ (test_engine_parity.py, + # test_engine_runtime.py) actually run here instead of skipping -- see + # #729; same reasoning as the `test` job above. - name: Install package, test and generator dependencies run: | python -m pip install -U pip setuptools wheel - python -m pip install -e '.[test,Scapy]' + python -m pip install -e '.[test,Scapy,DPKT]' # `shell: bash` rather than the default, because it runs with -o pipefail: # without it the `tee` below would swallow the generator's exit status. @@ -251,10 +259,13 @@ jobs: python-version: "3.14" cache: pip + # DPKT joins Scapy here for the same reason as the `integration` job + # above -- this is the full, unfiltered suite, so it is the one place + # where skipping the dpkt-gated tests would be most misleading. - name: Install package, test and generator dependencies run: | python -m pip install -U pip setuptools wheel - python -m pip install -e '.[test,Scapy]' + python -m pip install -e '.[test,Scapy,DPKT]' # See the integration job above for why this step is shaped the way it is. - name: Regenerate sample captures