Testing

What the suite has to prove, and what a change has to bring to it, is ruled on Testing a Change. Check a change module by module as that page describes; the make targets below run a whole tier.

Running the Tests

The unit tests need nothing beyond the package itself and the sample captures tracked in the repository:

make test

The runtime, regression and integration tests additionally read sample captures that are not tracked (see .gitignore); examples/generators/make_samples.py reconstructs them into examples/captures/, and make test-all regenerates them before running the whole suite:

make samples     # write examples/captures/*.pcap and *.pcapng
make test-all    # regenerate the fixtures, then run every test

The same fixtures back the demonstration scripts in examples/legacy_smoke/, which read them as ../captures/….

Continuous integration runs both: .github/workflows/unit-tests.yml runs the make test selection in its test job, and the fixture-dependent tests in its integration job, which runs examples/generators/make_samples.py first. Wireshark’s tshark is only required to exercise the PyShark engine, and is not needed by the test suite.

The Option Round-Trip Generator

One generator works differently from the rest. examples/generators/options.py does not describe packets it wants; it asks the library which option, chunk, parameter, message, frame and block codes it registers, and then constructs one of each through the public construction API, parses it back, and constructs it again from what was parsed. The options-*.pcap captures are the cases that survive that round trip, so they record what this version of pcapkit builds rather than what a third-party tool builds.

tests/protocols/test_option_roundtrip_unit.py runs the same cases without needing a fixture at all, and fails on any case that does not close the cycle unless its EXPECTED_FAILURES table names the defect that stops it.