Skip to content

test(bdc): count regex compilations on Python 3.10 too - #1378

Merged
dgunning merged 1 commit into
mainfrom
fix/test-1342-py310-compiler
Sep 28, 2026
Merged

dgunning merged 1 commit into
mainfrom
fix/test-1342-py310-compiler

Conversation

@dgunning

Copy link
Copy Markdown
Owner

test-fast (3.10) has failed on every push to main since #1343 (e.g. run 36442787663). The offline audit reports:

1 test(s) need the SEC but are marked `fast`, and are not in the baseline:
    tests/issues/regression/test_issue_1342.py::test_a_repeated_piped_identifier_compiles_no_regex

The test doesn't need the SEC. Its compilations fixture patches re._compiler.compile, which exists only on Python 3.11+. On 3.10 it raises AttributeError: module 're' has no attribute '_compiler'. PR CI runs only 3.13, so this only shows up after merge.

Fix: fall back to sre_compile, which 3.10's re calls through the module. This is a test-only change, so there's no changelog fragment.

Checked:

  • The unpatched test errors on 3.10.
  • The patched test passes on 3.10 and 3.13 under -p tests._offline_harness.
  • A probe confirms the patched compiler counts compilations on both versions.

🤖 Generated with Claude Code

test_issue_1342's fixture patched `re._compiler.compile`, which exists only
on 3.11+. On 3.10 the fixture raised AttributeError, and the offline audit in
test-fast (3.10) reported it as a fast test that needs the SEC, turning every
main run red since #1343. On 3.10 `re` calls `sre_compile.compile` through
the module, so patch that instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dgunning
dgunning enabled auto-merge (squash) September 28, 2026 16:28
@dgunning
dgunning merged commit 73491ae into main Sep 28, 2026
10 checks passed
@dgunning
dgunning deleted the fix/test-1342-py310-compiler branch September 28, 2026 16:42
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