Repository navigation
Run compiled functions as plain Python in the coverage check, and drop the per-test variants - #839
Merged
Merged
Conversation
…p the per-test variants The coverage check sets QLDPC_DISABLE_COMPILATION, so that qLDPC's compiled functions run as plain Python, which coverage traces, and no longer skips tests marked compiled. The fixtures, name lists, compiled and interpreted parameters, .py_func swaps and the compiled marker, which ran each test of compiled code twice, are gone. CI runs the test files of the modules with compiled functions, and the distance tests with the set-up code compiled too, with compilation on. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…code The coverage check sets QLDPC_DISABLE_COMPILATION and no longer skips tests marked compiled. The compiled CI job runs the test files of the modules with compiled functions, and the distance tests with the set-up code compiled too. The testing standard and the validation commands describe them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ctions to stay in distance Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ill a docstring Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…t functions stay in distance The testing standard names the compiled runs before using the term, and exempts only tests that compile their own functions even in the coverage gate. A test requires every compiled-on-request function to be defined in the distance package, whose tests CI runs with them compiled. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Nov 12, 2026
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
Coverage can't trace numba-compiled code. So far, each test of compiled code has had a hand-written plain-Python variant for the coverage check, in one of three styles: fixtures that swap hand-listed functions for their
.py_func, thecompilation_modefixture, orcompiled/interpretedparameters. The compiled variant carriedpytest.mark.compiled, which the coverage check skipped and a CI job of its own ran. Developers had to keep the lists of functions, learn which style a module used, and mark the variant, and reviewers had to check all of it. This PR replaces it all withQLDPC_DISABLE_COMPILATION(#836), which runs qLDPC's compiled functions as plain Python, and the pytest options for compiled runs (#837). The tests that were too slow for this as plain Python were shrunk in #838.Changes
checks/coverage_.pysetsQLDPC_DISABLE_COMPILATION, so that the coverage check runs qLDPC's compiled functions as plain Python, and it no longer skips any tests.compiledCI job now makes the compiled runs, in parallel, with compilation on: the test files of the modules that define compiled functions (--compiled-module-tests), and the distance tests with the compiled-on-request set-up code compiled too (--compile-search-setup). "Pytest and coverage check" still depends on it.compilation_mode,compiled/interpretedparameters and.py_funcswaps are removed, and the marker is unregistered.getattr(f, "py_func", f): a tracemalloc test, since tracemalloc traces only Python allocations, and a test that records calls.scan_test::test_python_kernels, which existed only for coverage, becomestest_counts_with_tiny_chunks_and_forced_tables, since it alone covers some lines ofscan.py.completion_bounds_test::test_bounds_are_exact_relaxationschecks the default 16-bit width only on its shorter tails, where that is fast as plain Python. Before, only its compiled variant checked that width, on every tail.coverage_.pyto check whether a module's tests pass and run fast as plain Python.qldpc.codes.distance, since only the distance tests run with them compiled. The_compilation.pydocstring states this, and a new test in_compilation_test.pyenforces it._compilation_test.pyfor the rules of compiled code, rather than counting and listing them.Testing
Every former compiled variant still runs compiled in one of the compiled runs, and the coverage check runs the same tests as before. Tests whose checks only mean something compiled, such as of a failed compilation or of agreement between plain and compiled code, pass trivially in the coverage check and check for real in a compiled run.
Additional notes
test_oracles_build_other_families_with_the_tuning_they_are_built_withreplaces a compiled-on-request function, so it now requestsplain_search_setupand runs with plain set-up code in every run. Before, its compiled variant ran with the set-up code compiled.information_sets_test::test_functions_agree_in_plain_python_and_compilednow requestsplain_search_setup, as that fixture's docstring asks of tests that compare plain with compiled set-up code..test_durationsholds per-file durations measured with compiled code, so the coverage shards may be less balanced until it is regenerated.