Skip to content

Commit 4e4e4e2

Browse files
authored
Merge branch 'main' into 13759-public-interface-for-matchmarker
2 parents f87cc2b + 37acc4f commit 4e4e4e2

34 files changed

+1517
-242
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: "v0.13.2"
3+
rev: "v0.13.3"
44
hooks:
55
- id: ruff-check
66
args: ["--fix"]
@@ -48,7 +48,7 @@ repos:
4848
# on <3.11
4949
- exceptiongroup>=1.0.0rc8
5050
- repo: https://github.com/RobertCraigie/pyright-python
51-
rev: v1.1.405
51+
rev: v1.1.406
5252
hooks:
5353
- id: pyright
5454
files: ^(src/|scripts/)
@@ -66,7 +66,7 @@ repos:
6666
# Manual because passing pyright is a work in progress.
6767
stages: [manual]
6868
- repo: https://github.com/tox-dev/pyproject-fmt
69-
rev: "v2.6.0"
69+
rev: "v2.7.0"
7070
hooks:
7171
- id: pyproject-fmt
7272
# https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version

AUTHORS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ Mike Hoyle (hoylemd)
320320
Mike Lundy
321321
Milan Lesnek
322322
Miro Hrončok
323+
Mulat Mekonen
323324
mrbean-bremen
324325
Nathan Goldbaum
325326
Nathan Rousseau
@@ -342,6 +343,7 @@ Oleg Sushchenko
342343
Oleksandr Zavertniev
343344
Olga Matoula
344345
Oliver Bestwalter
346+
Olivier Grisel
345347
Omar Kohl
346348
Omer Hadari
347349
Ondřej Súkup
@@ -382,6 +384,7 @@ Reza Mousavi
382384
Raquel Alegre
383385
Ravi Chandra
384386
Reagan Lee
387+
Reilly Brogan
385388
Rob Arrow
386389
Robert Holt
387390
Roberto Aldera
@@ -400,6 +403,7 @@ Sadra Barikbin
400403
Saiprasad Kale
401404
Samuel Colvin
402405
Samuel Dion-Girardeau
406+
Samuel Gaist
403407
Samuel Jirovec
404408
Samuel Searles-Bryant
405409
Samuel Therrien (Avasam)

changelog/12083.breaking.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Fixed a bug where an invocation such as `pytest a/ a/b` would cause only tests from `a/b` to run, and not other tests under `a/`.
2+
3+
The fix entails a few breaking changes to how such overlapping arguments and duplicates are handled:
4+
5+
1. `pytest a/b a/` or `pytest a/ a/b` are equivalent to `pytest a`; if an argument overlaps another arguments, only the prefix remains.
6+
7+
2. `pytest x.py x.py` is equivalent to `pytest x.py`; previously such an invocation was taken as an explicit request to run the tests from the file twice.
8+
9+
If you rely on these behaviors, consider using :ref:`--keep-duplicates <duplicate-paths>`, which retains its existing behavior (including the bug).

changelog/12244.contrib.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed self-test failures when `TERM=dumb`.

changelog/13330.improvement.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Having pytest configuration spread over more than one file (for example having both a ``pytest.ini`` file and ``pyproject.toml`` with a ``[tool.pytest.ini_options]`` table) will now print a warning to make it clearer to the user that only one of them is actually used.
2+
3+
-- by :user:`sgaist`

changelog/13678.feature.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Added a new `faulthandler_exit_on_timeout` ini option set to "false" by default to let `faulthandler` interrupt the `pytest` process after a timeout in case of deadlock -- by :user:`ogrisel`.
2+
3+
Previously, a `faulthandler` timeout would only dump the traceback of all threads to stderr, but would not interrupt the `pytest` process.

changelog/13771.contrib.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Skip `test_do_not_collect_symlink_siblings` on Windows environments without symlink support to avoid false negatives.

changelog/13791.packaging.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Minimum requirements on ``iniconfig`` and ``packaging`` were bumped
2+
to ``1.0.1`` and ``22.0.0``, respectively.

doc/en/example/pythoncollection.rst

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ You can run all of the tests within ``tests/`` *except* for ``tests/foobar/test_
5555
by invoking ``pytest`` with ``--deselect tests/foobar/test_foobar_01.py::test_a``.
5656
``pytest`` allows multiple ``--deselect`` options.
5757

58+
.. _duplicate-paths:
59+
5860
Keeping duplicate paths specified from command line
5961
----------------------------------------------------
6062

@@ -82,18 +84,6 @@ Example:
8284
collected 2 items
8385
...
8486
85-
As the collector just works on directories, if you specify twice a single test file, ``pytest`` will
86-
still collect it twice, no matter if the ``--keep-duplicates`` is not specified.
87-
Example:
88-
89-
.. code-block:: pytest
90-
91-
pytest test_a.py test_a.py
92-
93-
...
94-
collected 2 items
95-
...
96-
9787
9888
Changing directory recursion
9989
-----------------------------------------------------

doc/en/getting-started.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,26 @@ This is outlined below:
199199
200200
Note that attributes added at class level are *class attributes*, so they will be shared between tests.
201201

202+
Compare floating-point values with pytest.approx
203+
--------------------------------------------------------------
204+
205+
``pytest`` also provides a number of utilities to make writing tests easier.
206+
For example, you can use :func:`pytest.approx` to compare floating-point
207+
values that may have small rounding errors:
208+
209+
.. code-block:: python
210+
211+
# content of test_approx.py
212+
import pytest
213+
214+
215+
def test_sum():
216+
assert (0.1 + 0.2) == pytest.approx(0.3)
217+
218+
This avoids the need for manual tolerance checks or using
219+
``math.isclose`` and works with scalars, lists, and NumPy arrays.
220+
221+
202222
Request a unique temporary directory for functional tests
203223
--------------------------------------------------------------
204224

0 commit comments

Comments
 (0)