Skip to content

test: main is red on 3.11/3.12 — the re.sub DeprecationWarning test is ungated and CPython only warns from 3.13 #819

Description

@JarryShaw

Describe the bug

main is red on Python 3.11 and 3.12. tests/vendor/test_re_sub_positional_flag_unit.py::RuntimeDeprecationWarningTests::test_positional_flag_shape_would_warn asserts a DeprecationWarning that CPython only emits from 3.13, with no version guard:

tests/vendor/test_re_sub_positional_flag_unit.py:218
    with self.assertWarns(DeprecationWarning):
        re.sub(self.PATTERN, ' ', 'a\nb', re.MULTILINE)
AssertionError: DeprecationWarning not triggered
tests/vendor/test_re_sub_positional_flag_unit.py:221: AssertionError
1 failed, 1831 passed, 76 skipped, 45005 subtests passed in 485.74s

Four failing legs — Python 3.11, Python 3.12, Engines Python 3.11, Engines Python 3.12 — are one defect, not four.

Measured: on 3.14.7 the call warns; on 3.11/3.12 it does not. The 'count' is passed as positional argument deprecation landed in CPython 3.13.

Expected behavior

The test skips, or asserts the absence of the warning, below 3.13. The file's own module docstring at :25 already states the boundary — "It is also a live DeprecationWarning on Python 3.13+" — so the knowledge was there and the guard was not. grep -nE "version_info|skipIf|skipUnless" over the file returns nothing.

Additional context

Introduced by #813 (merged as 55e1b756e), and I cleared that PR as review: good-to-go on incomplete CI — it showed 27✅ 0❌ when I looked, but the 3.11/3.12 legs had not finished. That is my error, not the author's: its own verification ran on 3.14 only, which is the documented local interpreter, and the matrix is what exists to catch exactly this.

The sibling test immediately below, test_flags_keyword_shape_does_not_warn, is version-independent and correct — it asserts the absence of a warning, which holds on every version. Only the positive assertion needs gating.

Fix shape, cheapest first:

  1. @unittest.skipIf(sys.version_info < (3, 13), '...') on that one method, naming the CPython version in the reason.
  2. Or invert it: assert the warning on 3.13+ and its absence below, so both branches are pinned rather than one being skipped.

(2) is better — it keeps coverage on every leg instead of going dark on two of them, and it makes the version boundary itself a tested fact rather than a comment.

Note this is the second time today a test pinned a runtime symptom without gating its version. #788 had the mirror image: typing.final only records __final__ from 3.11, and the guard's boundary had to be pinned by an AST-derived test (test_the_shim_switches_at_the_version_that_added_the_dunder). That is the pattern to copy here.

Related: #813, #796, #788.

Activity

  1. added
    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)
    testPull requests that add or correct tests (test: subject prefix)
    ciPull requests that change CI or workflow configuration (ci: subject prefix)
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Sep 25, 2026
  2. JarryShaw commented on Sep 25, 2026

    @JarryShaw
    OwnerAuthor

    Correcting this issue's own scope: it is three Python versions and six legs, not two and four. #817's CI has now completed (inc=0), and the full picture is:

    Python 3.10, Python 3.11, Python 3.12, Engines Python 3.10, Engines Python 3.11, Engines Python 3.12
    

    I wrote "3.11 and 3.12" and "four failing legs" from a partial run — the same error that caused this issue in the first place, reading an incomplete check set as complete. The deprecation landed in CPython 3.13, so every matrix leg below it fails, and the repo tests 3.10 upward.

    That makes the fix shape more clearly right, not less: a skipIf would take six of the legs dark rather than four, leaving coverage only on 3.13 and 3.14. Inverting the assertion — warn on 3.13+, must not warn below — keeps all six pinned and makes the boundary itself the tested fact.

    Nothing else about the diagnosis changes: one defect, tests/vendor/test_re_sub_positional_flag_unit.py:218, no version_info/skipIf/skipUnless anywhere in the file, and its module docstring at :25 already naming the 3.13+ boundary it failed to gate on.

  3. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Sep 26, 2026
  4. added this to the 1.5 milestone on Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)ciPull requests that change CI or workflow configuration (ci: subject prefix)testPull requests that add or correct tests (test: subject prefix)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions