Ronny Pfannschmidt
bbe6b4a218
Merge pull request #12467 from RonnyPfannschmidt/ronny/new-annotations-try-2
...
from __future__ import annotations + migrate
2024-06-21 10:24:56 +02:00
Ronny Pfannschmidt
6a8e9ed43a
fixup: Config.cache cannot be None
2024-06-21 09:42:24 +02:00
Ronny Pfannschmidt
5e1649f59a
resolve most sphinx lookup errors
...
add the extra sphinx annotations to refer to Path instances
add Path to nitpicky ignore
2024-06-20 11:04:33 +02:00
Ronny Pfannschmidt
b7c0295e1a
use runtime union for EXCEPTION_OR_MORE
2024-06-20 11:03:07 +02:00
Ronny Pfannschmidt
9295f9ffff
RFC: from __future__ import annotations + migrate
2024-06-20 11:03:03 +02:00
Sviatoslav Sydorenko
39b548e6ea
📝 Make "setuptools entrypoint" term generic
...
This feature grew out of `setuptools` but the modern interface for
extracting this information from the distribution package metadata
is `importlib.metadata`. So the patch attempts to reflect this in
the documentation messaging.
Refs:
* https://docs.python.org/3/library/importlib.metadata.html#entry-points
* https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/#using-package-metadata
* https://packaging.python.org/en/latest/specifications/entry-points/#entry-points
2024-06-20 11:01:10 +02:00
Ronny Pfannschmidt
76f3f3da00
fix #11797 : be more lenient on SequenceLike approx
...
this needs a validation as it allows partially implemented sequences
2024-06-18 17:01:24 +02:00
Sviatoslav Sydorenko (Святослав Сидоренко)
49374ec7a0
🚑 Clarify patch condition for doctest finder hack ( #12471 )
...
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>
2024-06-18 09:21:25 +00:00
pre-commit-ci[bot]
ff75980135
[pre-commit.ci] pre-commit autoupdate ( #12447 )
...
* [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.7 → v0.4.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.7...v0.4.8 )
- [github.com/asottile/pyupgrade: v3.15.2 → v3.16.0](https://github.com/asottile/pyupgrade/compare/v3.15.2...v3.16.0 )
* Apply pyupgrade automatically
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
2024-06-11 12:36:39 -03:00
Ran Benita
23ca9798f7
doc: fix broken code blocks ( #12449 )
...
Caused by 4588653b24
.
The issue was fixed in https://github.com/astral-sh/ruff/issues/11577 ,
so won't trigger again.
Fix #12437 .
2024-06-11 12:36:20 -03:00
Ran Benita
7ef9da1f02
terminalwriter: improve `PYTEST_THEME`, `PYTEST_THEME_MODE` usage errors
2024-06-10 11:50:08 +03:00
Ran Benita
67a570aea9
terminalwriter: factor out pygments lexer & formatter selection to own functions
...
We intend to add some more logic here.
2024-06-10 11:48:19 +03:00
Ran Benita
f85289ba87
Merge pull request #12436 from bluetech/unittest-rerun-assertion
...
unittest: fix assertion errors on unittest reruns
2024-06-08 02:11:20 +03:00
Ran Benita
18f15a38fc
Merge pull request #12435 from bluetech/avoid-type-checking
...
Avoid some `TYPE_CHECKING`
2024-06-08 02:11:06 +03:00
Ran Benita
db67107090
Merge pull request #12434 from bluetech/register-fixture-scope-none
...
fixtures: change `register_fixture` to not accept `scope=None`
2024-06-07 12:11:56 +03:00
Ran Benita
de47b73520
unittest: fix assertion errors on unittest reruns
...
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.
2024-06-07 10:21:15 +03:00
Ran Benita
c07bbdfa5b
Avoid some TYPE_CHECKING
...
It's better not to use it when possible.
2024-06-07 09:36:55 +03:00
Jason R. Coombs
f941099371
Cleanup MockAwareDocTestFinder. ( #12431 )
...
* 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 #12430
Closes #12432
2024-06-07 09:32:33 +03:00
Ran Benita
c9d8765381
fixtures: change `register_fixture` to not accept `scope=None`
...
There is no reason to allow this.
2024-06-04 23:22:18 +03:00
Ran Benita
d4dbe771f0
Merge pull request #12409 from bluetech/reorder-items-perf
...
fixtures: fix catastrophic performance problem in `reorder_items`
2024-06-04 10:16:19 +03:00
Ran Benita
e89d23b247
fixtures: fix catastrophic performance problem in `reorder_items`
...
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.
2024-06-04 10:15:50 +03:00
Michael Vogt
7be95f9b30
code: do not truncate args when running with -vvv ( #12241 )
...
Related to #2871 .
2024-06-03 12:11:41 +00:00
Ran Benita
1eee63a891
fixtures: minor cleanups to reorder_items
...
This makes some minor clarity and performance improvements to the code.
2024-06-02 18:31:54 +03:00
Ran Benita
17065cb008
cacheprovider: fix "Directory not empty" crash from cache directory creation
...
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.
2024-06-02 17:05:36 +03:00
Pierre Sassoulas
0d33cdf02a
[pylint] Disable the only 'misplaced-bare-raise'
2024-05-29 14:36:01 +02:00
Pierre Sassoulas
db67d5c874
[pylint 'use-yield-from'] Fix all occurences in existing code
2024-05-29 14:36:01 +02:00
Bruno Oliveira
9f121e85a7
Clarify pytest_ignore_collect docs ( #12385 )
...
Fixes #12383
Co-authored-by: Ran Benita <ran@unusedvar.com>
2024-05-28 13:47:00 -03:00
pre-commit-ci[bot]
48cb8a2b32
[pre-commit.ci] pre-commit autoupdate ( #12380 )
...
* [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.4 → v0.4.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.4...v0.4.5 )
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-05-27 22:31:18 +00:00
Pierre Sassoulas
88fae23bdd
[pylint] Fixes all ``use-maxplit-args``, ``consider-using-enumerate`` ( #12172 )
...
* [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
2024-05-27 12:18:03 -07:00
Ran Benita
c3c51037f0
unittest: fix class instances no longer released on test teardown since pytest 8.2.0
...
Fix #12367 .
2024-05-26 10:18:42 +03:00
Ran Benita
1cb704ff2c
Add Python 3.13 (beta1) support
2024-05-19 09:25:13 +03:00
Jelle Zijlstra
ee9ea703f9
Fix new typing issues in AST code ( #12337 )
...
python/typeshed#11880 adds more precise types for AST nodes. I'm submitting some changes to adapt pytest to these changes.
2024-05-18 19:07:06 +03:00
Ran Benita
fdf3aa3fc3
Merge pull request #12329 from pytest-dev/fix-package-scope-reorder
...
fixtures: fix non-working package-scope parametrization reordering
2024-05-16 10:30:34 +03:00
Josh Soref
8d00811822
Spelling and minor changes ( #12122 )
2024-05-15 13:49:34 -03:00
Ran Benita
1acf56d033
fixtures: fix non-working package-scope parametrization reordering
...
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 .
2024-05-15 17:29:43 +03:00
Ran Benita
3a64c47f1f
cacheprovider: fix `.pytest_cache` not being world-readable
...
Fix #12308 .
2024-05-14 23:47:12 +03:00
Ran Benita
704792ecbd
Merge pull request #12311 from bluetech/pkg-collect-perm-error
...
python: add workaround for permission error crashes from non-selected directories
2024-05-13 20:32:23 +03:00
Ran Benita
37489d3c6c
python,unittest: don't collect abstract classes
...
Fix #12275 .
2024-05-13 13:00:47 +03:00
Ran Benita
90a3ef2f36
python: add workaround for permission error crashes from non-selected directories
...
Fix #12120 .
2024-05-12 22:38:49 +03:00
Yutian Li
5af46f3d4e
Fix crashing under squashfuse_ll read-only mounts ( #12301 )
...
Fixes #12300
2024-05-09 15:04:58 -03:00
Brian Okken
8efbefb2d7
New --xfail-tb flag ( #12280 )
...
Fix #12231
2024-05-07 14:37:00 -03:00
Bruno Oliveira
84e59af8c8
Document exceptions raised by exit, skip, xfail, fail, and importorskip ( #12285 )
...
As commented on: https://github.com/pytest-dev/pytest/issues/7469#issuecomment-2094104215
2024-05-05 22:53:16 +00:00
Anita Hammer
97610067ac
Handle KeyboardInterrupt and SystemExit at collection time ( #12191 )
2024-05-02 11:59:09 +00:00
Ben Brown
4c5298c395
Add back "Fix teardown error reporting when --maxfail=1 ( #11721 )" ( #12279 )
...
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 .
2024-05-02 10:42:31 +03:00
Pierre Sassoulas
2b6c946a2b
[mypy 1.10.0] Remove 'type: ignore' that became useless
2024-04-30 18:11:06 +02:00
Pierre Sassoulas
4788165e69
[ruff UP031] Fix to use format specifiers instead of percent format
2024-04-30 18:06:26 +02:00
Ran Benita
feaae2fb35
Merge pull request #12264 from bluetech/reraise-with-original-tb
...
fixtures,runner: fix tracebacks getting longer and longer
2024-04-29 20:02:44 +03:00
Ran Benita
e847b2a5a9
pre-commit: replace `debug-statements` hook with ruff
...
Ruff supports this functionality so we can use it.
2024-04-28 17:06:07 +03:00
Ran Benita
ebc4540436
Merge pull request #12258 from bluetech/xdist-align
...
terminal: fix progress percentages not aligning correctly in xdist
2024-04-28 16:52:40 +03:00
Ran Benita
3e81cb2f45
runner: fix tracebacks for failed collectors getting longer and longer
...
Refs https://github.com/pytest-dev/pytest/issues/12204#issuecomment-2081239376
2024-04-28 13:30:05 +03:00