Skip to content

fix(examples): stop legacy_smoke test_perf raising KeyError for engines it skips (#2305) - #2375

Merged
JarryShaw merged 1 commit into
mainfrom
fix/2305-legacy-smoke-perf-keyerror
Oct 27, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
fix/2305-legacy-smoke-perf-keyerror

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • fix — bug fix

Description

Closes #2305.

  • Problem: examples/legacy_smoke/test_perf.py walked _engine_support.ENGINES but looked each benchmark up in a table covering only default, pyshark, scapy and dpkt, so the first other engine to pass preflight (pypcap, pcap_ct, pypcapfile) raised KeyError and ended the run.
  • Fix: bench() now takes the engine name, so every engine in ENGINES is benchmarked into ../captures/engines/<engine>.txt or skipped with its reason. The README's engine list for test_perf follows.
  • Test: tests/project/test_legacy_smoke_perf_2305.py runs the demo with pyperf and the engine checks stubbed.

@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 27, 2026
@github-actions github-actions Bot added this to the PyPCAPKit v1.5 milestone Oct 27, 2026
@JarryShaw JarryShaw added bug Issues reporting a defect (set by the bug report template; a default, not an assessment) fix Pull requests that fix a defect (fix: subject prefix) labels Oct 27, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Review: GOOD TO GO at 9d58d4884 (Sonnet). Traced the issue's exact KeyError('pypcap') on origin/main via a stubbed pyperf/forced-preflight recipe; confirmed bench() now covers every entry in ENGINES (7 of 7) with byte-identical extract() kwargs for the 4 pre-existing engines; mutation-checked 7 variants (hard-coded engine, wrong path, half-fix, etc.) all fail the new test; skip path intact, doesn't swallow real failures. Clean merge onto current main despite being 6 commits behind.
Added labels (bug/fix) — reviewer's only metadata gap. One nit (docstring past-tense wording, #1103 convention) — fix dispatched.

…es it skips (#2305)

test_perf.py walked _engine_support.ENGINES but looked each benchmark up
in a table covering only default, pyshark, scapy and dpkt, so the first
other engine to pass preflight (pypcap, pcap_ct, pypcapfile) raised
KeyError and ended the run.

One bench() takes the engine name, so every engine in ENGINES is
benchmarked into ../captures/engines/<engine>.txt or skipped with its
reason. The README's engine list for test_perf follows.

tests/project/test_legacy_smoke_perf_2305.py runs the demo with pyperf
and the engine checks stubbed.
@JarryShaw
JarryShaw force-pushed the fix/2305-legacy-smoke-perf-keyerror branch from 9d58d48 to 3e38ac4 Compare October 27, 2026 07:48
@JarryShaw

Copy link
Copy Markdown
Owner Author

Rebased and amended 9d58d4884 → 3e38ac47b (6 commits onto current origin/main, clean): reworded the test module docstring off the past-tense narrative into the #1103 sweep's "defect as standing fact, so the code does X" convention. Prose-only, AST-confirmed no code change. 2/2 tests pass.

All review findings now addressed.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage: 91.58% (unit tier, Python 3.15, 3e38ac47b, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 19601 881 2620 867 92.12%
pcapkit/corekit 2596 74 818 37 96.51%
pcapkit/dumpkit 282 3 102 3 98.44%
pcapkit/foundation 3029 23 1050 25 98.82%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 17455 218 4598 185 98.15%
pcapkit/toolkit 914 36 334 10 95.51%
pcapkit/utilities 502 7 144 5 98.14%
pcapkit/vendor 4432 1988 1018 167 51.87%

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

@JarryShaw

Copy link
Copy Markdown
Owner Author

Ready to merge.

Review: GOOD TO GO (Sonnet) at 3e38ac47b.
CI: Required checks passed, 0 failures (only Sync Status pending).
Mergeable, 0 unresolved threads.

@JarryShaw JarryShaw added the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 27, 2026
@JarryShaw
JarryShaw merged commit 9121863 into main Oct 27, 2026
62 checks passed
@JarryShaw
JarryShaw deleted the fix/2305-legacy-smoke-perf-keyerror branch October 27, 2026 15:12
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 27, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issues reporting a defect (set by the bug report template; a default, not an assessment) fix Pull requests that fix a defect (fix: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix(examples): legacy_smoke test_perf raises KeyError for pypcap, pcap_ct and pypcapfile

1 participant