Skip to content

Narrow the plain_search_setup rule, check compiled-on-request locations at runtime, and say "plain Python" - #842

Merged
perlinm merged 6 commits into
mainfrom
test/compiled-testing-leftovers
Nov 12, 2026
Merged

perlinm merged 6 commits into
mainfrom
test/compiled-testing-leftovers

Conversation

@perlinm

@perlinm perlinm commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

Motivation

These are small leftovers from making the coverage check run qLDPC's compiled functions as plain Python (#836 to #840). The rule for the plain_search_setup fixture of the distance tests was broader than its reason, so some tests gave up their runs with compiled set-up code without needing to. The test that keeps compiled-on-request functions in qldpc.codes.distance scanned decorators in the source, so it missed a function registered by a call. The distance README restated rules and listed files that are defined elsewhere. The library also used both "ordinary Python" and "plain Python" for the same thing.

Changes

  • The plain_search_setup docstring now says that a test needs the fixture if it relies on a compiled-on-request function calling a function that the test replaces, since compiled callers would not call the replacement. Tests that replace a function that only plain-Python code calls no longer request the fixture, so they run with compiled set-up code again. These are the coset oracle test in coset_leader_search_test, the overlap test in brouwer_zimmermann_test, and the table-steps test in scan_test.
  • _compilation_test.py checks the location of compiled-on-request functions against the runtime registry, in a child process that imports every module, so it also catches f = compiled_on_request(f). The import loop is shared with the existing selection oracle, and each of the code strings has its own comment.
  • The distance README no longer names the files that use @compiled_on_request, and points to the fixture's docstring rather than restating its rule.
  • "Ordinary Python" becomes "plain Python" in _compilation.py and the docstring of compile_search_setup.

Testing

The tests that no longer request the fixture pass with compiled and with plain set-up code. The location test fails, naming the module, when a function in _binary.py is registered by a call.

perlinm and others added 6 commits November 12, 2026 09:40
… "plain Python" throughout

The plain_search_setup fixture is needed by tests that replace a function that a compiled-on-request
function calls, not by every test that replaces a compiled-on-request function, so an oracle test of
the coset search runs with compiled set-up code again.  The distance README points to the fixture's
docstring rather than restating the rule, and no longer lists the files that use
compiled_on_request.  "Ordinary Python" becomes "plain Python", the term used elsewhere.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ry, not the source

The test imports every module in a child process and checks the module of each registered function,
so it also catches a function registered by a call rather than by the decorator.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… the location check

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@perlinm
perlinm merged commit ff8c393 into main Nov 12, 2026
9 checks passed
@perlinm
perlinm deleted the test/compiled-testing-leftovers branch November 12, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant