Skip to content

🚑 Clarify patch condition for doctest finder hack - #12471

Merged
The-Compiler merged 1 commit into
pytest-dev:mainfrom
webknjaz:bugfixes/12431-regression-doctest-finder
Jun 18, 2024
Merged

The-Compiler merged 1 commit into
pytest-dev:mainfrom
webknjaz:bugfixes/12431-regression-doctest-finder

Conversation

@webknjaz

Copy link
Copy Markdown
Member

There was a regression caused by #12431 that excluded the patch on broken CPython patch version ranges 3.11.0–3.11.8 and 3.12.0–3.12.2.

This change fixes that by adjusting the patching conditional clause to include said versions.

Closes #12430.

Comment thread src/_pytest/doctest.py Resolved
Comment thread src/_pytest/doctest.py Resolved
Comment thread src/_pytest/doctest.py Resolved
Comment thread src/_pytest/doctest.py Resolved
There was a regression caused by pytest-dev#12431 that excluded the patch on
broken CPython patch version ranges 3.11.0–3.11.8 and 3.12.0–3.12.2.

This change fixes that by adjusting the patching conditional clause
to include said versions.

Closes pytest-dev#12430.

Co-authored-by: Florian Bruhin <[email protected]>
@webknjaz
webknjaz force-pushed the bugfixes/12431-regression-doctest-finder branch from fffe59d to 7183d07 Compare June 18, 2024 09:06
@webknjaz
webknjaz requested a review from The-Compiler June 18, 2024 09:06
@The-Compiler
The-Compiler enabled auto-merge (squash) June 18, 2024 09:08
@The-Compiler
The-Compiler merged commit 49374ec into pytest-dev:main Jun 18, 2024
@jaraco

jaraco commented Jun 18, 2024

Copy link
Copy Markdown
Contributor

Thanks @webknjaz and sorry for the regression.

Can we put a deadline on how long 3.11.8 and 3.12.2 need to be supported? I'd prefer to write the logic to indicate when the workaround can be removed. If the intention is to keep this support until Python 3.13, then maybe the check should be simplified to include the behavior on sys.version_info < (3, 13), but if support for older bugfix Pythons can be dropped sooner than that, then these extra checks make more sense. I'm pretty sure pytest doesn't track bugfix versions, but surely by the time support for Python 3.10 is dropped, pytest can rely on 3.11.9+ and 3.12.3+, right? Should we add a comment to that effect?

@The-Compiler

Copy link
Copy Markdown
Member

I'd probably keep it in for a while. It doesn't cost us much, and e.g. Debian stable packages Python 3.11.2 and is supported until mid 2028. Thus, I'd probably keep it in until we drop Python 3.11/3.12 support in October 2027/2028.

Yes, dealing with LTS distributions is annoying, but it's quite likely that someone will want to run pytest's selftests on a Debian stable machine at some point (or use pytest in a virtualenv with the system Python).

I'd still prefer to keep the version checks as-is in that case though, as it makes it easier to spot them once we e.g. drop Python 3.11 and see the check related to Python 3.11 (rather than it being < 3.13 and only touched when we drop 3.12 support).

I believe there was a time around Python 3.5 or 3.6 where we excluded .0 or .1 due to bigger typing defects, but other than that, I believe we've always aimed to keep support for all patch level versions. Especially for trivial workarounds, I think this is the right way forward, and keeping them is less costly than dropping them (and e.g. figuring out how to best communicate what exact patch levels we support).

Glyphack pushed a commit to Glyphack/pytest that referenced this pull request Jun 20, 2024
There was a regression caused by pytest-dev#12431 that excluded the patch on
broken CPython patch version ranges 3.11.0–3.11.8 and 3.12.0–3.12.2.

This change fixes that by adjusting the patching conditional clause
to include said versions.

Closes pytest-dev#12430.

Co-authored-by: Florian Bruhin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

MockAwareDocTestFinder._find_lineno is stale

3 participants