Skip to content

test(pcapng,sctp): replace dead checks with ones that can fail (#2226) - #2238

Merged
JarryShaw merged 1 commit into
mainfrom
test/2226-dead-checks
Oct 26, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
test/2226-dead-checks

Conversation

@JarryShaw

@JarryShaw JarryShaw commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • test — tests only

Description

Closes #2226. Three checks could not fail on main.

  • test_dumped_pcap_carries_the_payload_octets: the vacuous assertNotEqual(len(dumped), 104) goes. The exact-size assertEqual above it is what catches every PCAP-NG packet block loses its payload octets: packet is computed then overwritten with b'', so dumping through PCAPIO writes a record header claiming 314 octets followed by none #646, and the comment says so. At df23f7e6f^ that assertion fails before the deleted line is reached.
  • test_sctp_unit: the bitfield_packs_zero_bits probe and its skipTest are gone. With BitField.pre_process patched back to the old bug, main's copy skips and this one fails (True is not false).
  • test_block2frame_puts_the_on_wire_length_in_len: adds assertEqual(frame.cap_len, len(frame.packet)) and drops the NOTE that excused it. With block2frame patched to return one octet short, main's copy passes and this one fails (314 != 313).
  • Tests run: the three files give 54 passed, 0 skipped. test_chunk_flags_round_trip_with_mixed_bits now runs.

@JarryShaw JarryShaw added test Pull requests that add or correct tests (test: subject prefix) review: running A cross-review is in flight against the current head - no verdict yet labels Oct 26, 2026
@JarryShaw JarryShaw added this to the PyPCAPKit v1.5 milestone Oct 26, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Review: NEEDS CHANGES at 5ff243c5f (Sonnet).

  • Still dead: assertNotEqual(len(dumped), 24 + 16 * len(expected)) cannot fail first. At df23f7e6f^, with this PR's tests, the record count (1 != 4) and the exact-size assertEqual above it fail earlier. It only fails (88 == 88) once those are stripped. Drop the line, as the issue allows; the assertEqual pins the size.
  • Confirmed: the SCTP check. With BitField.pre_process patched back, it fails with True is not false.
  • Confirmed: the cap_len check. With block2frame returning one octet short, it fails 6 subtests.
  • Nothing else weakened. The three files plus the tier guard give 187 passed.

@JarryShaw JarryShaw added review: needs-changes Cross-review at the current head says changes are required; see the verdict comment and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 26, 2026
Three checks could not fail: a != 104 size check no tree produces, a
BitField probe gating the SCTP mixed-bit round trip that is always true,
and a NOTE excusing the PCAP-NG side of the cap_len/packet equality.

- test_dumped_pcap_carries_the_payload_octets: drop the != 104 line; the
  exact-size assertEqual above it is what catches #646, and the comment
  now says so.
- test_sctp_unit: drop bitfield_packs_zero_bits and its skipTest; the
  mixed-bit test runs unconditionally.
- test_block2frame_puts_the_on_wire_length_in_len: assert
  cap_len == len(frame.packet) and drop the NOTE.
@JarryShaw
JarryShaw force-pushed the test/2226-dead-checks branch from 5ff243c to 1e8c7f7 Compare October 26, 2026 03:55
@JarryShaw JarryShaw added review: running A cross-review is in flight against the current head - no verdict yet and removed review: needs-changes Cross-review at the current head says changes are required; see the verdict comment labels Oct 26, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Review: GOOD TO GO at 1e8c7f711 (Sonnet delta review of 5ff243c5f→1e8c7f711).

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 26, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage: 91.56% (unit tier, Python 3.15, 1e8c7f711, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 19599 881 2618 867 92.11%
pcapkit/corekit 2589 74 816 37 96.51%
pcapkit/dumpkit 282 3 102 3 98.44%
pcapkit/foundation 2994 23 1038 25 98.81%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 17433 218 4584 185 98.15%
pcapkit/toolkit 869 36 298 10 95.20%
pcapkit/utilities 504 7 146 5 98.15%
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 at 1e8c7f711. Closes #2226.

  • Review: Sonnet GOOD TO GO, after one NEEDS CHANGES round.
  • CI: all checks complete, Required checks passed SUCCESS, 0 failed.
  • KTLO: 12 legs, no warnings.
  • Ordering: merged into main and run. protocols leg: 1924 tests, 0 failures.
  • Conflicts: none against the current main.

@JarryShaw
JarryShaw merged commit e7d7238 into main Oct 26, 2026
64 checks passed
@JarryShaw
JarryShaw deleted the test/2226-dead-checks branch October 26, 2026 13:59
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 26, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 26, 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.

test(pcapng,sctp): dead assertion, dead skip gate and an unneeded NOTE

1 participant