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.
Co-authored-by: Florian Bruhin <me@the-compiler.org>
This fixes unittest test reruns when using plugins like
pytest-rerunfailures.
The `instance` property uses AttributeError to check if the instance
needs to be initialized, so `del` is the correct way to clear it, not
setting to `None`.
Regressed in 8.2.2.
* Only rely on _find_lineno on Python 3.10 and earlier.
* Update docstring to reflect current expectation.
* Only rely on _find on Python 3.9 and earlier.
* Mark line as uncovered.
* Remove empty else block (implicit is better than explicit).
Closes#12430Closes#12432
Fix#12355.
In the issue, it was reported that the `reorder_items` has quadratic (or
worse...) behavior with certain simple parametrizations. After some
debugging I found that the problem happens because the "Fix
items_by_argkey order" loop keeps adding the same item to the deque,
and it reaches epic sizes which causes the slowdown.
I don't claim to understand how the `reorder_items` algorithm works, but
if as far as I understand, if an item already exists in the deque, the
correct thing to do is to move it to the front. Since a deque doesn't
have such an (efficient) operation, this switches to `OrderedDict` which
can efficiently append from both sides, deduplicate and move to front.
Fix#12381
Test plan:
It's possible to write a deterministic test case for this, but somewhat
of a hassle so I tested it manually. I reproduced by removing existing
`.pytest_cache`, adding a sleep before the rename and running two
pytests. I verified that it doesn't reproduce after the fix.
* [pylint 'use-maxsplit-arg'] Do not split more than necessary when using the first element
* [pylint 'consider-using-enumerate'] Use zip when iterating on two iterators
* [pylint] 'cell-var-from-loop' and 'disallowed-name' permanent disable
* [pylint] Disable 'possibly-used-before-assignment' following 3.2.0 release
The `.parent` was incorrectly removed in
a21fb87a90, but it was actually correct
(well, it assumes that Module.path.parent == Package.path, which I'm not
sure is always correct, but that's a different matter). Restore it.
Fix#12328.
Closes#11706.
Originally fixed in #11721, but then reverted in #12022 due to a regression in pytest-xdist.
The regression was fixed on the pytest-xdist side in pytest-dev/pytest-xdist#1026.
In these two cases which re-raise an immediately-caught exception, do
the re-raising with `raise` instead of `raise exc`, because the `raise
exc` adds an uninteresting entry to the exception's traceback (that of
itself), while `raise` doesn't.