Repository navigation
run coverage only on python 3.14 in CI - #63
Merged
Merged
Conversation
Before 3.14, coverage traces with sys.settrace, which slows the tests down several times and makes the timing-sensitive websocket tests flaky. 3.14+ uses sys.monitoring (PEP 669), so the other versions run the tests without coverage. Co-Authored-By: Claude Opus 5.5 <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.
Motivation
On Python 3.10–3.13, coverage (7.16) measures with its C tracer through
sys.settrace, which runs a callback for every line in every frame, including the test client, Twisted and websocket-client code it doesn't report on. Since 3.14, coverage usessys.monitoring(PEP 669) by default and disables events for code it has already seen, so its overhead is close to zero.This shows in CI:
tests/websocket/test_websockets.pytakes 23–30 s on 3.14/3.15, but 42–127 s on 3.10–3.13. The websocket tests run the client and the server in one process and depend on timing, for example the server's 5 s close timeout, so the slowdown made them flaky. In a recent failure,test_server_close_while_client_is_sendingfailed on 3.11 in a run where that file took 127 s.Changes
COVERAGE_PYTHON_VERSION) runsmake test-coverageand reports to Coveralls.make test, which collects the same 212 tests.🤖 Generated with Claude Code