Skip to content

Commit b8e95af

Browse files
authored
Merge branch 'main' into fix-exit-exceptiongroup-13650
2 parents 0f624e0 + 2b285f5 commit b8e95af

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+4766
-1004
lines changed

.coveragerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ exclude_lines =
2525
^\s*raise NotImplementedError\b
2626
^\s*return NotImplemented\b
2727
^\s*assert False(,|$)
28+
^\s*case unreachable:
2829
^\s*assert_never\(
2930

3031
^\s*if TYPE_CHECKING:

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
persist-credentials: true
5151

5252
- name: Download Package
53-
uses: actions/download-artifact@v5
53+
uses: actions/download-artifact@v6
5454
with:
5555
name: Packages
5656
path: dist
@@ -86,7 +86,7 @@ jobs:
8686
persist-credentials: false
8787

8888
- name: Download Package
89-
uses: actions/download-artifact@v5
89+
uses: actions/download-artifact@v6
9090
with:
9191
name: Packages
9292
path: dist

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ jobs:
256256
persist-credentials: false
257257

258258
- name: Download Package
259-
uses: actions/download-artifact@v5
259+
uses: actions/download-artifact@v6
260260
with:
261261
name: Packages
262262
path: dist

.pre-commit-config.yaml

Lines changed: 4 additions & 4 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.14.0"
3+
rev: "v0.14.2"
44
hooks:
55
- id: ruff-check
66
args: ["--fix"]
@@ -12,7 +12,7 @@ repos:
1212
- id: end-of-file-fixer
1313
- id: check-yaml
1414
- repo: https://github.com/woodruffw/zizmor-pre-commit
15-
rev: v1.14.2
15+
rev: v1.16.0
1616
hooks:
1717
- id: zizmor
1818
- repo: https://github.com/adamchainz/blacken-docs
@@ -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.406
51+
rev: v1.1.407
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.10.0"
69+
rev: "v2.11.0"
7070
hooks:
7171
- id: pyproject-fmt
7272
# https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Carlos Jenkins
8383
Ceridwen
8484
Charles Cloud
8585
Charles Machalow
86+
Charles-Meldhine Madi Mnemoi (cmnemoi)
8687
Charnjit SiNGH (CCSJ)
8788
Cheuk Ting Ho
8889
Chris Mahoney

CONTRIBUTING.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ Short version
203203

204204
#. Write a ``changelog`` entry: ``changelog/2574.bugfix.rst``, use issue id number
205205
and one of ``feature``, ``improvement``, ``bugfix``, ``doc``, ``deprecation``,
206-
``breaking``, ``vendor`` or ``trivial`` for the issue type.
206+
``breaking``, ``vendor``, ``packaging``, ``contrib``, or ``misc`` for the issue type.
207207

208208

209209
#. Unless your change is a trivial or a documentation fix (e.g., a typo or reword of a small section) please
@@ -305,8 +305,9 @@ Here is a simple overview, with pytest-specific bits:
305305

306306
#. Create a new changelog entry in ``changelog``. The file should be named ``<issueid>.<type>.rst``,
307307
where *issueid* is the number of the issue related to the change and *type* is one of
308-
``feature``, ``improvement``, ``bugfix``, ``doc``, ``deprecation``, ``breaking``, ``vendor``
309-
or ``trivial``. You may skip creating the changelog entry if the change doesn't affect the
308+
``feature``, ``improvement``, ``bugfix``, ``doc``, ``deprecation``, ``breaking``, ``vendor``,
309+
``packaging``, ``contrib``, or ``misc``.
310+
You may skip creating the changelog entry if the change doesn't affect the
310311
documented behaviour of pytest.
311312

312313
#. Add yourself to ``AUTHORS`` file if not there yet, in alphabetical order.

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ To execute it::
7979
========================== 1 failed in 0.04 seconds ===========================
8080

8181

82-
Due to ``pytest``'s detailed assertion introspection, only plain ``assert`` statements are used. See `getting-started <https://docs.pytest.org/en/stable/getting-started.html#our-first-test-run>`_ for more examples.
82+
Thanks to ``pytest``'s detailed assertion introspection, you can simply use plain ``assert`` statements. See `getting-started <https://docs.pytest.org/en/stable/getting-started.html#our-first-test-run>`_ for more examples.
8383

8484

8585
Features

changelog/13537.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix bug in which ExceptionGroup with only Skipped exceptions in teardown was not handled correctly and showed as error.

changelog/1367.feature.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
**Support for subtests** has been added.
2+
3+
:ref:`subtests <subtests>` are an alternative to parametrization, useful in situations where the parametrization values are not all known at collection time.
4+
5+
**Example**
6+
7+
.. code-block:: python
8+
9+
def contains_docstring(p: Path) -> bool:
10+
"""Return True if the given Python file contains a top-level docstring."""
11+
...
12+
13+
14+
def test_py_files_contain_docstring(subtests: pytest.Subtests) -> None:
15+
for path in Path.cwd().glob("*.py"):
16+
with subtests.test(path=str(path)):
17+
assert contains_docstring(path)
18+
19+
20+
Each assert failure or error is caught by the context manager and reported individually, giving a clear picture of all files that are missing a docstring.
21+
22+
In addition, :meth:`unittest.TestCase.subTest` is now also supported.
23+
24+
This feature was originally implemented as a separate plugin in `pytest-subtests <https://github.com/pytest-dev/pytest-subtests>`__, but since then has been merged into the core.
25+
26+
.. note::
27+
28+
This feature is experimental and will likely evolve in future releases. By that we mean that we might change how subtests are reported on failure, but the functionality and how to use it are stable.

changelog/13743.feature.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Added support for native TOML configuration files.
2+
3+
While pytest, since version 6, supports configuration in ``pyproject.toml`` files under ``[tool.pytest.ini_options]``,
4+
it does so in an "INI compatibility mode", where all configuration values are treated as strings or list of strings.
5+
Now, pytest supports the native TOML data model.
6+
7+
In ``pyproject.toml``, the native TOML configuration is under the ``[tool.pytest]`` table.
8+
9+
.. code-block:: toml
10+
11+
# pyproject.toml
12+
[tool.pytest]
13+
minversion = "9.0"
14+
addopts = ["-ra", "-q"]
15+
testpaths = [
16+
"tests",
17+
"integration",
18+
]
19+
20+
The ``[tool.pytest.ini_options]`` table remains supported, but both tables cannot be used at the same time.
21+
22+
If you prefer to use a separate configuration file, or don't use ``pyproject.toml``, you can use ``pytest.toml`` or ``.pytest.toml``:
23+
24+
.. code-block:: toml
25+
26+
# pytest.toml or .pytest.toml
27+
[pytest]
28+
minversion = "9.0"
29+
addopts = ["-ra", "-q"]
30+
testpaths = [
31+
"tests",
32+
"integration",
33+
]
34+
35+
The documentation now shows configuration snippets in both TOML and INI formats, in a tabbed interface.
36+
37+
See :ref:`config file formats` for full details.

0 commit comments

Comments
 (0)