test: expand coverage to 100% and add 90% coverage gate to CI - #32
Merged
Merged
Conversation
Expand test coverage from 62% to 100% by adding tests for all previously untested modules (exe_comm, trace, runner, processor, dce_runner) using mocks for subprocess and external binaries. Add missing branch tests for simulation.py. Add pytest-cov to requirements.txt and wire --cov-fail-under=90 into the CI workflow so coverage regressions block the build. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
sys.exit() in library code is a code smell — callers can't catch it meaningfully. Raise ValueError instead so the error propagates cleanly. Update the test to match. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move CLI logic into _main() which returns an int, so sys.exit() only appears as the sole statement in __main__ — the standard pattern that static analysers accept. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--cov-fail-under=90to the CI workflow so coverage regressions block the buildpytest-covtorequirements.txtNew test files
tests/test_exe_comm.pytests/test_trace.py_unit_factor,_bottleneck_speed, a2b/b2a parsing, no-connections exit, bad timestamp fallbacktests/test_processor.pyPcapProcessor.__init__,process(),process_and_write()delegationtests/test_runner.pySimulationRunnershape/cleanup/missing-ascii,BfsRunnerxscale loop and per-flow writestests/test_dce_runner.pyjobs_dir, inittests/test_simulation.pyelsebranch inQueueSizeCalculator,bottleneckSpeedinWafCommandBuilderTest plan
pytest --cov=pcapprocessor --cov-fail-under=90passes locally (100% coverage, 47/47 tests)🤖 Generated with Claude Code