Skip to content

use callable protocols for pytest.skip/exit/fail/xfail instead of _WithException wrapper with __call__ attribute#13445

Merged
bluetech merged 5 commits intopytest-dev:mainfrom
karlicoss:pytest_skip_paramspec
Jun 27, 2025
Merged

use callable protocols for pytest.skip/exit/fail/xfail instead of _WithException wrapper with __call__ attribute#13445
bluetech merged 5 commits intopytest-dev:mainfrom
karlicoss:pytest_skip_paramspec

Conversation

@karlicoss
Copy link
Contributor

@karlicoss karlicoss commented May 28, 2025

This is a more canonical way of typing generic callbacks/decorators
(see https://mypy.readthedocs.io/en/stable/protocols.html#callback-protocols)

This helps with potential issues/ambiguity with __call__ semanics in
type checkers -- according to python spec, __call__ needs to be present
on the class, rather than as an instance attribute to be considered callable.

This worked in mypy because it didn't handle the spec 100% correctly (in this case this has no negative consequences)

However, ty type checker is stricter/more correct about it and every pytest.skip usage results in:

error[call-non-callable]: Object of type _WithException[Unknown, <class 'Skipped'>] is not callable

For more context, see:

Testing:

Tested with running mypy against the following snippet:

import pytest
reveal_type(pytest.skip)
reveal_type(pytest.skip.Exception)
reveal_type(pytest.skip(reason="whatever"))

Before the change:

$ mypy test_pytest_skip.py
test_pytest_skip.py:2: note: Revealed type is "_pytest.outcomes._WithException[def (reason: builtins.str =, *, allow_module_level: builtins.bool =) -> Never, def (msg: Union[builtins.str, None] =, pytrace: builtins.bool =, allow_module_level: builtins.bool =, *, _use_item_location: builtins.bool =) -> _pytest.outcomes.Skipped]"
test_pytest_skip.py:3: note: Revealed type is "def (msg: Union[builtins.str, None] =, pytrace: builtins.bool =, allow_module_level: builtins.bool =, *, _use_item_location: builtins.bool =) -> _pytest.outcomes.Skipped"
test_pytest_skip.py:4: note: Revealed type is "Never"

After the change:

$ mypy test_pytest_skip.py
test_pytest_skip.py:2: note: Revealed type is "_pytest.outcomes._Skip"
test_pytest_skip.py:3: note: Revealed type is "type[_pytest.outcomes.Skipped]"
test_pytest_skip.py:4: note: Revealed type is "Never"

ty type checker is also inferring the same types correctly now.

All types are matching and propagated correctly (most importantly, Never as a result of pytest.skip(...) call

@karlicoss karlicoss force-pushed the pytest_skip_paramspec branch from a0735e1 to 58892a3 Compare May 28, 2025 01:40
@bluetech
Copy link
Member

Thanks! This looks good to me. But looking at this again, I wonder if it wouldn't be simpler (in terms of complexity, not in terms of lines of code) to turn these functions into callable classes? Then the Exception is a regular (class) attribute and there should be no typing shenanigans necessary, unless I'm missing something. WDYT?

@bluetech
Copy link
Member

Forgot to mention, the CI failures are unrelated and fixed in main -- rebase should take care of it.

@karlicoss
Copy link
Contributor Author

karlicoss commented Jun 9, 2025

Hi @bluetech -- sorry, just got around to try this, did on a separate branch (just on skip to start with) 56b3937

Something like this (If I understood your suggestion correctly)

+class _Skip:
+    Exception = Skipped
+
+    def __call__(self, reason: str = "", allow_module_level: bool = False) -> NoReturn:
+        __tracebackhide__ = True
+        raise Skipped(msg=reason, allow_module_level=allow_module_level)
+
+skip = _Skip()

This generally works, and seems to result in correct runtime/typecheck time types. However it fails this test:

def test_skip_simple(self):
with pytest.raises(pytest.skip.Exception) as excinfo:
pytest.skip("xxx")
assert excinfo.traceback[-1].frame.code.name == "skip"
assert excinfo.traceback[-1].ishidden(excinfo)
assert excinfo.traceback[-2].frame.code.name == "test_skip_simple"
assert not excinfo.traceback[-2].ishidden(excinfo)

$ tox -e py39-xdist
    def test_skip_simple(self):
        with pytest.raises(pytest.skip.Exception) as excinfo:
            pytest.skip("xxx")
>       assert excinfo.traceback[-1].frame.code.name == "skip"
E       AssertionError: assert '__call__' == 'skip'
E
E         - skip
E         + __call__

testing/python/collect.py:1078: AssertionError

Which kinda makes sense -- python would normally print just in __call__ in the stacktrace, not even in <Classname>.__call__.

Apart from that, the remaining asserts pass if I change the assert to assert excinfo.traceback[-1].frame.code.name == "__call__".
Not sure what's the intent of assert -- if it's just meant to check that skip was called, or we actually want the user to see skip in the trace.

So up to you if you'd prefer me to convert the rest (exit/fail/xfail), move over docstrings and fix the tests; or you'd rather not touch it!

@karlicoss
Copy link
Contributor Author

Hi @bluetech -- any thoughts on this? :)

This is a more canonical way of typing generic callbacks/decorators
 (see https://mypy.readthedocs.io/en/stable/protocols.html#callback-protocols)

This helps with potential issues/ambiguity with `__call__` semanics in
type checkers -- according to python spec, `__call__` needs to be present
on the class, rather than as an instance attribute to be considered callable.

This worked in mypy because it didn't handle the spec 100% correctly (in this case this has no negative consequences)

However, `ty` type checker is stricter/more correct about it and every `pytest.skip` usage results in:

`error[call-non-callable]: Object of type `_WithException[Unknown, <class 'Skipped'>]` is not callable`

For more context, see:
- astral-sh/ruff#17832 (comment)
- https://discuss.python.org/t/when-should-we-assume-callable-types-are-method-descriptors/92938

Testing:

Tested with running mypy against the following snippet:
```
import pytest
reveal_type(pytest.skip)
reveal_type(pytest.skip.Exception)
reveal_type(pytest.skip(reason="whatever"))
```

Before the change:

```
test_pytest_skip.py:2: note: Revealed type is "_pytest.outcomes._WithException[def (reason: builtins.str =, *, allow_module_level: builtins.bool =) -> Never, def (msg: Union[builtins.str, None] =, pytrace: builtins.bool =, allow_module_level: builtins.bool =, *, _use_item_location: builtins.bool =) -> _pytest.outcomes.Skipped]"
test_pytest_skip.py:3: note: Revealed type is "def (msg: Union[builtins.str, None] =, pytrace: builtins.bool =, allow_module_level: builtins.bool =, *, _use_item_location: builtins.bool =) -> _pytest.outcomes.Skipped"
test_pytest_skip.py:4: note: Revealed type is "Never"
```

After the change:
```
test_pytest_skip.py:2: note: Revealed type is "_pytest.outcomes._WithException[[reason: builtins.str =, *, allow_module_level: builtins.bool =], Never, def (msg: Union[builtins.str, None] =, pytrace: builtins.bool =, allow_module_level: builtins.bool =, *, _use_item_location: builtins.bool =) -> _pytest.outcomes.Skipped]"
test_pytest_skip.py:3: note: Revealed type is "def (msg: Union[builtins.str, None] =, pytrace: builtins.bool =, allow_module_level: builtins.bool =, *, _use_item_location: builtins.bool =) -> _pytest.outcomes.Skipped"
test_pytest_skip.py:4: note: Revealed type is "Never"
```

All types are matching and propagated correctly.
@bluetech bluetech force-pushed the pytest_skip_paramspec branch from befc88e to da59835 Compare June 24, 2025 11:37
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jun 24, 2025
@bluetech
Copy link
Member

I rebased your current code and added a changelog to make things green in case we want to go with that.

Something like this (If I understood your suggestion correctly)

Yes.

This generally works, and seems to result in correct runtime/typecheck time types. However it fails this test:

The purpose of the test is to test that the frame is hidden, so it's OK that the name is changed. The test can be fixed like this:

-        assert excinfo.traceback[-1].frame.code.name == "skip"
+        if sys.version_info >= (3, 11):
+            assert excinfo.traceback[-1].frame.code.raw.co_qualname == "_Skip.__call__"

(there's probably a way to get the qualified name before py311 but wouldn't bother)

One thing I was concerned about is sphinx autodoc not understanding the __call__ business but it seems to work as expected if the docstring is put on the class.

The __call__ indirection is also a slight degradation for "go to definition" functionality but I think it's fine.

So I think the __call__ should work and seems cleaner to me, but the current code in the PR is also a strict improvement and fixes the problem, so no problem going with that if you don't want to do the bigger change.

…thException wrapper with __call__ attribute

This is a more canonical way of typing generic callbacks/decorators
 (see https://mypy.readthedocs.io/en/stable/protocols.html#callback-protocols)

This helps with potential issues/ambiguity with `__call__` semanics in
type checkers -- according to python spec, `__call__` needs to be present
on the class, rather than as an instance attribute to be considered callable.

This worked in mypy because it didn't handle the spec 100% correctly (in this case this has no negative consequences)

However, `ty` type checker is stricter/more correct about it and every `pytest.skip` usage results in:

`error[call-non-callable]: Object of type `_WithException[Unknown, <class 'Skipped'>]` is not callable`

For more context, see:
- astral-sh/ruff#17832 (comment)
- https://discuss.python.org/t/when-should-we-assume-callable-types-are-method-descriptors/92938

Testing:

Tested with running mypy against the following snippet:
```
import pytest
reveal_type(pytest.skip)
reveal_type(pytest.skip.Exception)
reveal_type(pytest.skip(reason="whatever"))
```

Before the change:

```
$ mypy test_pytest_skip.py
test_pytest_skip.py:2: note: Revealed type is "_pytest.outcomes._WithException[def (reason: builtins.str =, *, allow_module_level: builtins.bool =) -> Never, def (msg: Union[builtins.str, None] =, pytrace: builtins.bool =, allow_module_level: builtins.bool =, *, _use_item_location: builtins.bool =) -> _pytest.outcomes.Skipped]"
test_pytest_skip.py:3: note: Revealed type is "def (msg: Union[builtins.str, None] =, pytrace: builtins.bool =, allow_module_level: builtins.bool =, *, _use_item_location: builtins.bool =) -> _pytest.outcomes.Skipped"
test_pytest_skip.py:4: note: Revealed type is "Never"
```

After the change:
```
$ mypy test_pytest_skip.py
test_pytest_skip.py:2: note: Revealed type is "_pytest.outcomes._Skip"
test_pytest_skip.py:3: note: Revealed type is "type[_pytest.outcomes.Skipped]"
test_pytest_skip.py:4: note: Revealed type is "Never"
```

`ty` type checker is also inferring the same types correctly now.

All types are matching and propagated correctly (most importantly, `Never` as a result of `pytest.skip(...)` call
@karlicoss
Copy link
Contributor Author

Thanks for suggestions @bluetech!
Converted all of skip/fail/etc to simple protocols with __call__ and it looks quite clean now, and types are simpler, so hopefully less chances of type checkers shenanigans (e.g. ty correctly infers Never as a result of pytest.skip(...)).
I refined MR description and commit message to reflect the change, so feel free to use the last one when you squash!

@karlicoss karlicoss changed the title use ParamSpec for pytest.skip instead of __call__ Protocol attribute use callable protocols for pytest.skip/exit/fail/xfail instead of _WithException wrapper with __call__ attribute Jun 25, 2025
Copy link
Member

@bluetech bluetech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update @karlicoss. Please see my comments, other than them it looks good!

Exception: _ET
__call__: _F
def __call__(self, reason: str = "", returncode: int | None = None) -> NoReturn:
"""Exit testing process.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put the docstring on the class, so that sphinx picks it up correctly. You can verify that it works by checking that it shows up in the PR docs preview (currently empty): https://pytest--13445.org.readthedocs.build/en/13445/reference/reference.html#pytest-skip

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh this docs pipeline is neat, didn't notice that! Moved and seems like it's picked up correctly now

_ET = TypeVar("_ET", bound=type[BaseException])

class _Exit:
Exception: type[Exit] = Exit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually we omit an explicit annotation when it is inferred.

Also, here I think a ClassVar annotation would be appropriate. So Exception: ClassVar = Exit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, added ClassVar -- see below comment re: type annotation

It is better to use the :ref:`pytest.mark.xfail ref` marker when
possible to declare a test to be xfailed under certain conditions
like known bugs or missing features.
# Exposed helper methods.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My slight preference it to have the exit = _Exit etc. below the class _Exit instead of group at the bottom, it makes it easier to understand what it's about IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

"""
__tracebackhide__ = True
raise XFailed(reason)
exit: _Exit = _Exit()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Here too I think we can omit the explicit type annotations)

Copy link
Contributor Author

@karlicoss karlicoss Jun 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I added them because otherwise ty was inferring pytest.skip(reason=...) as Unknown instead of Never -- which is a consequence (and possibly there is some bug involved too) of how ty handles unannotated module/class attributes at the moment.
I reported it here astral-sh/ty#433 (comment)

So if we remove explicit annotation, ty would infer pytest.skip(...) as Unknown at the moment -- this would defeat the purpose of typing annotations to an extent (although would still be a net improvement as at least it wouldn't report pytest.skip as false positives).
IMO would be nice to keep them even if it's a minor 'style' inconsistency as it doesn't make anything else worse. We could leave a comment in code explaining why it's annotated (so someone doesn't remove by accident), but now that the outcome objects are next to the corresponding class it's a bit harder, since would require duplicating the comment 4 times :) Not sure what to do, but looks like this file really isn't modified frequently, and the risk of losing annotations is low -- and in the meantime ty might sort out the Unknown shenanigans.

I can remove the Exception annotations apart from ClassVar if you prefer -- the only downside is that ty would infer pytest.skip.Exception as Unknown, but this doesn't feel like a big deal and everything else would still work as expected.

Let me know what you think!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't say I understand the rationale of ty to behave this way, but it's intentional and it's just a minor style thing. So let's keep the annotations.

Copy link
Member

@bluetech bluetech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @karlicoss!

@bluetech bluetech merged commit eced426 into pytest-dev:main Jun 27, 2025
36 checks passed
@karlicoss
Copy link
Contributor Author

Thank you! Appreciate your time

@karlicoss karlicoss deleted the pytest_skip_paramspec branch June 27, 2025 15:27
736-c41-2c1-e464fc974 added a commit to Swiss-Armed-Forces/Loom that referenced this pull request Feb 4, 2026
This MR contains the following updates:

| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [pytest](https://github.com/pytest-dev/pytest) ([changelog](https://docs.pytest.org/en/stable/changelog.html)) | test | major | `^8.2.0` → `^9.0.0` | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/pytest-dev/pytest/badge)](https://securityscorecards.dev/viewer/?uri=github.com/pytest-dev/pytest) |

---

### Release Notes

<details>
<summary>pytest-dev/pytest (pytest)</summary>

### [`v9.0.2`](https://github.com/pytest-dev/pytest/releases/tag/9.0.2)

[Compare Source](pytest-dev/pytest@9.0.1...9.0.2)

### pytest 9.0.2 (2025-12-06)

#### Bug fixes

- [#&#8203;13896](pytest-dev/pytest#13896): The terminal progress feature added in pytest 9.0.0 has been disabled by default, except on Windows, due to compatibility issues with some terminal emulators.

  You may enable it again by passing `-p terminalprogress`. We may enable it by default again once compatibility improves in the future.

  Additionally, when the environment variable `TERM` is `dumb`, the escape codes are no longer emitted, even if the plugin is enabled.

- [#&#8203;13904](pytest-dev/pytest#13904): Fixed the TOML type of the `tmp_path_retention_count` settings in the API reference from number to string.

- [#&#8203;13946](pytest-dev/pytest#13946): The private `config.inicfg` attribute was changed in a breaking manner in pytest 9.0.0.
  Due to its usage in the ecosystem, it is now restored to working order using a compatibility shim.
  It will be deprecated in pytest 9.1 and removed in pytest 10.

- [#&#8203;13965](pytest-dev/pytest#13965): Fixed quadratic-time behavior when handling `unittest` subtests in Python 3.10.

#### Improved documentation

- [#&#8203;4492](pytest-dev/pytest#4492): The API Reference now contains cross-reference-able documentation of `pytest's command-line flags <command-line-flags>`.

### [`v9.0.1`](https://github.com/pytest-dev/pytest/releases/tag/9.0.1)

[Compare Source](pytest-dev/pytest@9.0.0...9.0.1)

### pytest 9.0.1 (2025-11-12)

#### Bug fixes

- [#&#8203;13895](pytest-dev/pytest#13895): Restore support for skipping tests via `raise unittest.SkipTest`.
- [#&#8203;13896](pytest-dev/pytest#13896): The terminal progress plugin added in pytest 9.0 is now automatically disabled when iTerm2 is detected, it generated desktop notifications instead of the desired functionality.
- [#&#8203;13904](pytest-dev/pytest#13904): Fixed the TOML type of the verbosity settings in the API reference from number to string.
- [#&#8203;13910](pytest-dev/pytest#13910): Fixed <span class="title-ref">UserWarning: Do not expect file\_or\_dir</span> on some earlier Python 3.12 and 3.13 point versions.

#### Packaging updates and notes for downstreams

- [#&#8203;13933](pytest-dev/pytest#13933): The tox configuration has been adjusted to make sure the desired
  version string can be passed into its `package_env` through
  the `SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST` environment
  variable as a part of the release process -- by `webknjaz`.

#### Contributor-facing changes

- [#&#8203;13891](pytest-dev/pytest#13891), [#&#8203;13942](pytest-dev/pytest#13942): The CI/CD part of the release automation is now capable of
  creating GitHub Releases without having a Git checkout on
  disk -- by `bluetech` and `webknjaz`.
- [#&#8203;13933](pytest-dev/pytest#13933): The tox configuration has been adjusted to make sure the desired
  version string can be passed into its `package_env` through
  the `SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST` environment
  variable as a part of the release process -- by `webknjaz`.

### [`v9.0.0`](https://github.com/pytest-dev/pytest/releases/tag/9.0.0)

[Compare Source](pytest-dev/pytest@8.4.2...9.0.0)

### pytest 9.0.0 (2025-11-05)

#### New features

- [#&#8203;1367](pytest-dev/pytest#1367): **Support for subtests** has been added.

  `subtests <subtests>` are an alternative to parametrization, useful in situations where the parametrization values are not all known at collection time.

  Example:

  ```python
  def contains_docstring(p: Path) -> bool:
      """Return True if the given Python file contains a top-level docstring."""
      ...

  def test_py_files_contain_docstring(subtests: pytest.Subtests) -> None:
      for path in Path.cwd().glob("*.py"):
          with subtests.test(path=str(path)):
              assert contains_docstring(path)
  ```

  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.

  In addition, `unittest.TestCase.subTest` is now also supported.

  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.

  > \[!NOTE]
  > 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.

- [#&#8203;13743](pytest-dev/pytest#13743): Added support for **native TOML configuration files**.

  While pytest, since version 6, supports configuration in `pyproject.toml` files under `[tool.pytest.ini_options]`,
  it does so in an "INI compatibility mode", where all configuration values are treated as strings or list of strings.
  Now, pytest supports the native TOML data model.

  In `pyproject.toml`, the native TOML configuration is under the `[tool.pytest]` table.

  ```toml
  # pyproject.toml
  [tool.pytest]
  minversion = "9.0"
  addopts = ["-ra", "-q"]
  testpaths = [
      "tests",
      "integration",
  ]
  ```

  The `[tool.pytest.ini_options]` table remains supported, but both tables cannot be used at the same time.

  If you prefer to use a separate configuration file, or don't use `pyproject.toml`, you can use `pytest.toml` or `.pytest.toml`:

  ```toml
  # pytest.toml or .pytest.toml
  [pytest]
  minversion = "9.0"
  addopts = ["-ra", "-q"]
  testpaths = [
      "tests",
      "integration",
  ]
  ```

  The documentation now (sometimes) shows configuration snippets in both TOML and INI formats, in a tabbed interface.

  See `config file formats` for full details.

- [#&#8203;13823](pytest-dev/pytest#13823): Added a **"strict mode"** enabled by the `strict` configuration option.

  When set to `true`, the `strict` option currently enables

  - `strict_config`
  - `strict_markers`
  - `strict_parametrization_ids`
  - `strict_xfail`

  The individual strictness options can be explicitly set to override the global `strict` setting.

  The previously-deprecated `--strict` command-line flag now enables strict mode.

  If pytest adds new strictness options in the future, they will also be enabled in strict mode.
  Therefore, you should only enable strict mode if you use a pinned/locked version of pytest,
  or if you want to proactively adopt new strictness options as they are added.

  See `strict mode` for more details.

- [#&#8203;13737](pytest-dev/pytest#13737): Added the `strict_parametrization_ids` configuration option.

  When set, pytest emits an error if it detects non-unique parameter set IDs,
  rather than automatically making the IDs unique by adding <span class="title-ref">0</span>, <span class="title-ref">1</span>, ... to them.
  This can be particularly useful for catching unintended duplicates.

- [#&#8203;13072](pytest-dev/pytest#13072): Added support for displaying test session **progress in the terminal tab** using the [OSC 9;4;](https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC) ANSI sequence.
  When pytest runs in a supported terminal emulator like ConEmu, Gnome Terminal, Ptyxis, Windows Terminal, Kitty or Ghostty,
  you'll see the progress in the terminal tab or window,
  allowing you to monitor pytest's progress at a glance.

  This feature is automatically enabled when running in a TTY. It is implemented as an internal plugin. If needed, it can be disabled as follows:

  - On a user level, using `-p no:terminalprogress` on the command line or via an environment variable `PYTEST_ADDOPTS='-p no:terminalprogress'`.
  - On a project configuration level, using `addopts = "-p no:terminalprogress"`.

- [#&#8203;478](pytest-dev/pytest#478): Support PEP420 (implicit namespace packages) as <span class="title-ref">--pyargs</span> target when `consider_namespace_packages` is <span class="title-ref">true</span> in the config.

  Previously, this option only impacted package imports, now it also impacts tests discovery.

- [#&#8203;13678](pytest-dev/pytest#13678): Added a new `faulthandler_exit_on_timeout` configuration option set to "false" by default to let <span class="title-ref">faulthandler</span> interrupt the <span class="title-ref">pytest</span> process after a timeout in case of deadlock.

  Previously, a <span class="title-ref">faulthandler</span> timeout would only dump the traceback of all threads to stderr, but would not interrupt the <span class="title-ref">pytest</span> process.

  \-- by `ogrisel`.

- [#&#8203;13829](pytest-dev/pytest#13829): Added support for configuration option aliases via the `aliases` parameter in `Parser.addini() <pytest.Parser.addini>`.

  Plugins can now register alternative names for configuration options,
  allowing for more flexibility in configuration naming and supporting backward compatibility when renaming options.
  The canonical name always takes precedence if both the canonical name and an alias are specified in the configuration file.

#### Improvements in existing functionality

- [#&#8203;13330](pytest-dev/pytest#13330): 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.

  \-- by `sgaist`

- [#&#8203;13574](pytest-dev/pytest#13574): The single argument `--version` no longer loads the entire plugin infrastructure, making it faster and more reliable when displaying only the pytest version.

  Passing `--version` twice (e.g., `pytest --version --version`) retains the original behavior, showing both the pytest version and plugin information.

  > \[!NOTE]
  > Since `--version` is now processed early, it only takes effect when passed directly via the command line. It will not work if set through other mechanisms, such as `PYTEST_ADDOPTS` or `addopts`.

- [#&#8203;13823](pytest-dev/pytest#13823): Added `strict_xfail` as an alias to the `xfail_strict` option,
  `strict_config` as an alias to the `--strict-config` flag,
  and `strict_markers` as an alias to the `--strict-markers` flag.
  This makes all strictness options consistently have configuration options with the prefix `strict_`.

- [#&#8203;13700](pytest-dev/pytest#13700): <span class="title-ref">--junitxml</span> no longer prints the <span class="title-ref">generated xml file</span> summary at the end of the pytest session when <span class="title-ref">--quiet</span> is given.

- [#&#8203;13732](pytest-dev/pytest#13732): Previously, when filtering warnings, pytest would fail if the filter referenced a class that could not be imported. Now, this only outputs a message indicating the problem.

- [#&#8203;13859](pytest-dev/pytest#13859): Clarify the error message for <span class="title-ref">pytest.raises()</span> when a regex <span class="title-ref">match</span> fails.

- [#&#8203;13861](pytest-dev/pytest#13861): Better sentence structure in a test's expected error message. Previously, the error message would be "expected exception must be \<expected>, but got \<actual>". Now, it is "Expected \<expected>, but got \<actual>".

#### Removals and backward incompatible breaking changes

- [#&#8203;12083](pytest-dev/pytest#12083): Fixed a bug where an invocation such as <span class="title-ref">pytest a/ a/b</span> would cause only tests from <span class="title-ref">a/b</span> to run, and not other tests under <span class="title-ref">a/</span>.

  The fix entails a few breaking changes to how such overlapping arguments and duplicates are handled:

  1. <span class="title-ref">pytest a/b a/</span> or <span class="title-ref">pytest a/ a/b</span> are equivalent to <span class="title-ref">pytest a</span>; if an argument overlaps another arguments, only the prefix remains.
  2. <span class="title-ref">pytest x.py x.py</span> is equivalent to <span class="title-ref">pytest x.py</span>; previously such an invocation was taken as an explicit request to run the tests from the file twice.

  If you rely on these behaviors, consider using `--keep-duplicates <duplicate-paths>`, which retains its existing behavior (including the bug).

- [#&#8203;13719](pytest-dev/pytest#13719): Support for Python 3.9 is dropped following its end of life.

- [#&#8203;13766](pytest-dev/pytest#13766): Previously, pytest would assume it was running in a CI/CD environment if either of the environment variables <span class="title-ref">$CI</span> or <span class="title-ref">$BUILD\_NUMBER</span> was defined;
  now, CI mode is only activated if at least one of those variables is defined and set to a *non-empty* value.

- [#&#8203;13779](pytest-dev/pytest#13779): **PytestRemovedIn9Warning deprecation warnings are now errors by default.**

  Following our plan to remove deprecated features with as little disruption as
  possible, all warnings of type `PytestRemovedIn9Warning` now generate errors
  instead of warning messages by default.

  **The affected features will be effectively removed in pytest 9.1**, so please consult the
  `deprecations` section in the docs for directions on how to update existing code.

  In the pytest `9.0.X` series, it is possible to change the errors back into warnings as a
  stopgap measure by adding this to your `pytest.ini` file:

  ```ini
  [pytest]
  filterwarnings =
      ignore::pytest.PytestRemovedIn9Warning
  ```

  But this will stop working when pytest `9.1` is released.

  **If you have concerns** about the removal of a specific feature, please add a
  comment to `13779`.

#### Deprecations (removal in next major release)

- [#&#8203;13807](pytest-dev/pytest#13807): `monkeypatch.syspath_prepend() <pytest.MonkeyPatch.syspath_prepend>` now issues a deprecation warning when the prepended path contains legacy namespace packages (those using `pkg_resources.declare_namespace()`).
  Users should migrate to native namespace packages (`420`).
  See `monkeypatch-fixup-namespace-packages` for details.

#### Bug fixes

- [#&#8203;13445](pytest-dev/pytest#13445): Made the type annotations of `pytest.skip` and friends more spec-complaint to have them work across more type checkers.

- [#&#8203;13537](pytest-dev/pytest#13537): Fixed a bug in which `ExceptionGroup` with only `Skipped` exceptions in teardown was not handled correctly and showed as error.

- [#&#8203;13598](pytest-dev/pytest#13598): Fixed possible collection confusion on Windows when short paths and symlinks are involved.

- [#&#8203;13716](pytest-dev/pytest#13716): Fixed a bug where a nonsensical invocation like `pytest x.py[a]` (a file cannot be parametrized) was silently treated as `pytest x.py`. This is now a usage error.

- [#&#8203;13722](pytest-dev/pytest#13722): Fixed a misleading assertion failure message when using `pytest.approx` on mappings with differing lengths.

- [#&#8203;13773](pytest-dev/pytest#13773): Fixed the static fixture closure calculation to properly consider transitive dependencies requested by overridden fixtures.

- [#&#8203;13816](pytest-dev/pytest#13816): Fixed `pytest.approx` which now returns a clearer error message when comparing mappings with different keys.

- [#&#8203;13849](pytest-dev/pytest#13849): Hidden `.pytest.ini` files are now picked up as the config file even if empty.
  This was an inconsistency with non-hidden `pytest.ini`.

- [#&#8203;13865](pytest-dev/pytest#13865): Fixed <span class="title-ref">--show-capture</span> with <span class="title-ref">--tb=line</span>.

- [#&#8203;13522](pytest-dev/pytest#13522): Fixed `pytester` in subprocess mode ignored all :attr\`pytester.plugins \<pytest.Pytester.plugins>\` except the first.

  Fixed `pytester` in subprocess mode silently ignored non-str `pytester.plugins <pytest.Pytester.plugins>`.
  Now it errors instead.
  If you are affected by this, specify the plugin by name, or switch the affected tests to use `pytester.runpytest_inprocess <pytest.Pytester.runpytest_inprocess>` explicitly instead.

#### Packaging updates and notes for downstreams

- [#&#8203;13791](pytest-dev/pytest#13791): Minimum requirements on `iniconfig` and `packaging` were bumped to `1.0.1` and `22.0.0`, respectively.

#### Contributor-facing changes

- [#&#8203;12244](pytest-dev/pytest#12244): Fixed self-test failures when <span class="title-ref">TERM=dumb</span>.
- [#&#8203;12474](pytest-dev/pytest#12474): Added scheduled GitHub Action Workflow to run Sphinx linkchecks in repo documentation.
- [#&#8203;13621](pytest-dev/pytest#13621): pytest's own testsuite now handles the `lsof` command hanging (e.g. due to unreachable network filesystems), with the affected selftests being skipped after 10 seconds.
- [#&#8203;13638](pytest-dev/pytest#13638): Fixed deprecated `gh pr new` command in `scripts/prepare-release-pr.py`.
  The script now uses `gh pr create` which is compatible with GitHub CLI v2.0+.
- [#&#8203;13695](pytest-dev/pytest#13695): Flush <span class="title-ref">stdout</span> and <span class="title-ref">stderr</span> in <span class="title-ref">Pytester.run</span> to avoid truncated outputs in <span class="title-ref">test\_faulthandler.py::test\_timeout</span> on CI -- by `ogrisel`.
- [#&#8203;13771](pytest-dev/pytest#13771): Skip <span class="title-ref">test\_do\_not\_collect\_symlink\_siblings</span> on Windows environments without symlink support to avoid false negatives.
- [#&#8203;13841](pytest-dev/pytest#13841): `tox>=4` is now required when contributing to pytest.
- [#&#8203;13625](pytest-dev/pytest#13625): Added missing docstrings to `pytest_addoption()`, `pytest_configure()`, and `cacheshow()` functions in `cacheprovider.py`.

#### Miscellaneous internal changes

- [#&#8203;13830](pytest-dev/pytest#13830): Configuration overrides (`-o`/`--override-ini`) are now processed during startup rather than during `config.getini() <pytest.Config.getini>`.

</details>

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yLjQiLCJ1cGRhdGVkSW5WZXIiOiI0My4yLjQiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbImRlcGVuZGVuY2llcyIsInJlbm92YXRlIl19-->

See merge request swiss-armed-forces/cyber-command/cea/loom!285

Co-authored-by: Loom MR Pipeline Trigger <group_103951964_bot_9504bb8dead6d4e406ad817a607f24be@noreply.gitlab.com>
Co-authored-by: shrewd-laidback palace <shrewd-laidback-palace-736-c41-2c1-e464fc974@swiss-armed-forces-open-source.ch>
736-c41-2c1-e464fc974 added a commit to Swiss-Armed-Forces/Loom that referenced this pull request Feb 4, 2026
chore(deps): update pytest (major)

This MR contains the following updates:

| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [pytest](https://github.com/pytest-dev/pytest) ([changelog](https://docs.pytest.org/en/stable/changelog.html)) | test | major | `^8.2.0` → `^9.0.0` | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/pytest-dev/pytest/badge)](https://securityscorecards.dev/viewer/?uri=github.com/pytest-dev/pytest) |

---

### Release Notes

<details>
<summary>pytest-dev/pytest (pytest)</summary>

### [`v9.0.2`](https://github.com/pytest-dev/pytest/releases/tag/9.0.2)

[Compare Source](pytest-dev/pytest@9.0.1...9.0.2)

### pytest 9.0.2 (2025-12-06)

#### Bug fixes

- [#&#8203;13896](pytest-dev/pytest#13896): The terminal progress feature added in pytest 9.0.0 has been disabled by default, except on Windows, due to compatibility issues with some terminal emulators.

  You may enable it again by passing `-p terminalprogress`. We may enable it by default again once compatibility improves in the future.

  Additionally, when the environment variable `TERM` is `dumb`, the escape codes are no longer emitted, even if the plugin is enabled.

- [#&#8203;13904](pytest-dev/pytest#13904): Fixed the TOML type of the `tmp_path_retention_count` settings in the API reference from number to string.

- [#&#8203;13946](pytest-dev/pytest#13946): The private `config.inicfg` attribute was changed in a breaking manner in pytest 9.0.0.
  Due to its usage in the ecosystem, it is now restored to working order using a compatibility shim.
  It will be deprecated in pytest 9.1 and removed in pytest 10.

- [#&#8203;13965](pytest-dev/pytest#13965): Fixed quadratic-time behavior when handling `unittest` subtests in Python 3.10.

#### Improved documentation

- [#&#8203;4492](pytest-dev/pytest#4492): The API Reference now contains cross-reference-able documentation of `pytest's command-line flags <command-line-flags>`.

### [`v9.0.1`](https://github.com/pytest-dev/pytest/releases/tag/9.0.1)

[Compare Source](pytest-dev/pytest@9.0.0...9.0.1)

### pytest 9.0.1 (2025-11-12)

#### Bug fixes

- [#&#8203;13895](pytest-dev/pytest#13895): Restore support for skipping tests via `raise unittest.SkipTest`.
- [#&#8203;13896](pytest-dev/pytest#13896): The terminal progress plugin added in pytest 9.0 is now automatically disabled when iTerm2 is detected, it generated desktop notifications instead of the desired functionality.
- [#&#8203;13904](pytest-dev/pytest#13904): Fixed the TOML type of the verbosity settings in the API reference from number to string.
- [#&#8203;13910](pytest-dev/pytest#13910): Fixed <span class="title-ref">UserWarning: Do not expect file\_or\_dir</span> on some earlier Python 3.12 and 3.13 point versions.

#### Packaging updates and notes for downstreams

- [#&#8203;13933](pytest-dev/pytest#13933): The tox configuration has been adjusted to make sure the desired
  version string can be passed into its `package_env` through
  the `SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST` environment
  variable as a part of the release process -- by `webknjaz`.

#### Contributor-facing changes

- [#&#8203;13891](pytest-dev/pytest#13891), [#&#8203;13942](pytest-dev/pytest#13942): The CI/CD part of the release automation is now capable of
  creating GitHub Releases without having a Git checkout on
  disk -- by `bluetech` and `webknjaz`.
- [#&#8203;13933](pytest-dev/pytest#13933): The tox configuration has been adjusted to make sure the desired
  version string can be passed into its `package_env` through
  the `SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST` environment
  variable as a part of the release process -- by `webknjaz`.

### [`v9.0.0`](https://github.com/pytest-dev/pytest/releases/tag/9.0.0)

[Compare Source](pytest-dev/pytest@8.4.2...9.0.0)

### pytest 9.0.0 (2025-11-05)

#### New features

- [#&#8203;1367](pytest-dev/pytest#1367): **Support for subtests** has been added.

  `subtests <subtests>` are an alternative to parametrization, useful in situations where the parametrization values are not all known at collection time.

  Example:

  ```python
  def contains_docstring(p: Path) -> bool:
      """Return True if the given Python file contains a top-level docstring."""
      ...

  def test_py_files_contain_docstring(subtests: pytest.Subtests) -> None:
      for path in Path.cwd().glob("*.py"):
          with subtests.test(path=str(path)):
              assert contains_docstring(path)
  ```

  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.

  In addition, `unittest.TestCase.subTest` is now also supported.

  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.

  > \[!NOTE]
  > 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.

- [#&#8203;13743](pytest-dev/pytest#13743): Added support for **native TOML configuration files**.

  While pytest, since version 6, supports configuration in `pyproject.toml` files under `[tool.pytest.ini_options]`,
  it does so in an "INI compatibility mode", where all configuration values are treated as strings or list of strings.
  Now, pytest supports the native TOML data model.

  In `pyproject.toml`, the native TOML configuration is under the `[tool.pytest]` table.

  ```toml
  # pyproject.toml
  [tool.pytest]
  minversion = "9.0"
  addopts = ["-ra", "-q"]
  testpaths = [
      "tests",
      "integration",
  ]
  ```

  The `[tool.pytest.ini_options]` table remains supported, but both tables cannot be used at the same time.

  If you prefer to use a separate configuration file, or don't use `pyproject.toml`, you can use `pytest.toml` or `.pytest.toml`:

  ```toml
  # pytest.toml or .pytest.toml
  [pytest]
  minversion = "9.0"
  addopts = ["-ra", "-q"]
  testpaths = [
      "tests",
      "integration",
  ]
  ```

  The documentation now (sometimes) shows configuration snippets in both TOML and INI formats, in a tabbed interface.

  See `config file formats` for full details.

- [#&#8203;13823](pytest-dev/pytest#13823): Added a **"strict mode"** enabled by the `strict` configuration option.

  When set to `true`, the `strict` option currently enables

  - `strict_config`
  - `strict_markers`
  - `strict_parametrization_ids`
  - `strict_xfail`

  The individual strictness options can be explicitly set to override the global `strict` setting.

  The previously-deprecated `--strict` command-line flag now enables strict mode.

  If pytest adds new strictness options in the future, they will also be enabled in strict mode.
  Therefore, you should only enable strict mode if you use a pinned/locked version of pytest,
  or if you want to proactively adopt new strictness options as they are added.

  See `strict mode` for more details.

- [#&#8203;13737](pytest-dev/pytest#13737): Added the `strict_parametrization_ids` configuration option.

  When set, pytest emits an error if it detects non-unique parameter set IDs,
  rather than automatically making the IDs unique by adding <span class="title-ref">0</span>, <span class="title-ref">1</span>, ... to them.
  This can be particularly useful for catching unintended duplicates.

- [#&#8203;13072](pytest-dev/pytest#13072): Added support for displaying test session **progress in the terminal tab** using the [OSC 9;4;](https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC) ANSI sequence.
  When pytest runs in a supported terminal emulator like ConEmu, Gnome Terminal, Ptyxis, Windows Terminal, Kitty or Ghostty,
  you'll see the progress in the terminal tab or window,
  allowing you to monitor pytest's progress at a glance.

  This feature is automatically enabled when running in a TTY. It is implemented as an internal plugin. If needed, it can be disabled as follows:

  - On a user level, using `-p no:terminalprogress` on the command line or via an environment variable `PYTEST_ADDOPTS='-p no:terminalprogress'`.
  - On a project configuration level, using `addopts = "-p no:terminalprogress"`.

- [#&#8203;478](pytest-dev/pytest#478): Support PEP420 (implicit namespace packages) as <span class="title-ref">--pyargs</span> target when `consider_namespace_packages` is <span class="title-ref">true</span> in the config.

  Previously, this option only impacted package imports, now it also impacts tests discovery.

- [#&#8203;13678](pytest-dev/pytest#13678): Added a new `faulthandler_exit_on_timeout` configuration option set to "false" by default to let <span class="title-ref">faulthandler</span> interrupt the <span class="title-ref">pytest</span> process after a timeout in case of deadlock.

  Previously, a <span class="title-ref">faulthandler</span> timeout would only dump the traceback of all threads to stderr, but would not interrupt the <span class="title-ref">pytest</span> process.

  \-- by `ogrisel`.

- [#&#8203;13829](pytest-dev/pytest#13829): Added support for configuration option aliases via the `aliases` parameter in `Parser.addini() <pytest.Parser.addini>`.

  Plugins can now register alternative names for configuration options,
  allowing for more flexibility in configuration naming and supporting backward compatibility when renaming options.
  The canonical name always takes precedence if both the canonical name and an alias are specified in the configuration file.

#### Improvements in existing functionality

- [#&#8203;13330](pytest-dev/pytest#13330): 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.

  \-- by `sgaist`

- [#&#8203;13574](pytest-dev/pytest#13574): The single argument `--version` no longer loads the entire plugin infrastructure, making it faster and more reliable when displaying only the pytest version.

  Passing `--version` twice (e.g., `pytest --version --version`) retains the original behavior, showing both the pytest version and plugin information.

  > \[!NOTE]
  > Since `--version` is now processed early, it only takes effect when passed directly via the command line. It will not work if set through other mechanisms, such as `PYTEST_ADDOPTS` or `addopts`.

- [#&#8203;13823](pytest-dev/pytest#13823): Added `strict_xfail` as an alias to the `xfail_strict` option,
  `strict_config` as an alias to the `--strict-config` flag,
  and `strict_markers` as an alias to the `--strict-markers` flag.
  This makes all strictness options consistently have configuration options with the prefix `strict_`.

- [#&#8203;13700](pytest-dev/pytest#13700): <span class="title-ref">--junitxml</span> no longer prints the <span class="title-ref">generated xml file</span> summary at the end of the pytest session when <span class="title-ref">--quiet</span> is given.

- [#&#8203;13732](pytest-dev/pytest#13732): Previously, when filtering warnings, pytest would fail if the filter referenced a class that could not be imported. Now, this only outputs a message indicating the problem.

- [#&#8203;13859](pytest-dev/pytest#13859): Clarify the error message for <span class="title-ref">pytest.raises()</span> when a regex <span class="title-ref">match</span> fails.

- [#&#8203;13861](pytest-dev/pytest#13861): Better sentence structure in a test's expected error message. Previously, the error message would be "expected exception must be \<expected>, but got \<actual>". Now, it is "Expected \<expected>, but got \<actual>".

#### Removals and backward incompatible breaking changes

- [#&#8203;12083](pytest-dev/pytest#12083): Fixed a bug where an invocation such as <span class="title-ref">pytest a/ a/b</span> would cause only tests from <span class="title-ref">a/b</span> to run, and not other tests under <span class="title-ref">a/</span>.

  The fix entails a few breaking changes to how such overlapping arguments and duplicates are handled:

  1. <span class="title-ref">pytest a/b a/</span> or <span class="title-ref">pytest a/ a/b</span> are equivalent to <span class="title-ref">pytest a</span>; if an argument overlaps another arguments, only the prefix remains.
  2. <span class="title-ref">pytest x.py x.py</span> is equivalent to <span class="title-ref">pytest x.py</span>; previously such an invocation was taken as an explicit request to run the tests from the file twice.

  If you rely on these behaviors, consider using `--keep-duplicates <duplicate-paths>`, which retains its existing behavior (including the bug).

- [#&#8203;13719](pytest-dev/pytest#13719): Support for Python 3.9 is dropped following its end of life.

- [#&#8203;13766](pytest-dev/pytest#13766): Previously, pytest would assume it was running in a CI/CD environment if either of the environment variables <span class="title-ref">$CI</span> or <span class="title-ref">$BUILD\_NUMBER</span> was defined;
  now, CI mode is only activated if at least one of those variables is defined and set to a *non-empty* value.

- [#&#8203;13779](pytest-dev/pytest#13779): **PytestRemovedIn9Warning deprecation warnings are now errors by default.**

  Following our plan to remove deprecated features with as little disruption as
  possible, all warnings of type `PytestRemovedIn9Warning` now generate errors
  instead of warning messages by default.

  **The affected features will be effectively removed in pytest 9.1**, so please consult the
  `deprecations` section in the docs for directions on how to update existing code.

  In the pytest `9.0.X` series, it is possible to change the errors back into warnings as a
  stopgap measure by adding this to your `pytest.ini` file:

  ```ini
  [pytest]
  filterwarnings =
      ignore::pytest.PytestRemovedIn9Warning
  ```

  But this will stop working when pytest `9.1` is released.

  **If you have concerns** about the removal of a specific feature, please add a
  comment to `13779`.

#### Deprecations (removal in next major release)

- [#&#8203;13807](pytest-dev/pytest#13807): `monkeypatch.syspath_prepend() <pytest.MonkeyPatch.syspath_prepend>` now issues a deprecation warning when the prepended path contains legacy namespace packages (those using `pkg_resources.declare_namespace()`).
  Users should migrate to native namespace packages (`420`).
  See `monkeypatch-fixup-namespace-packages` for details.

#### Bug fixes

- [#&#8203;13445](pytest-dev/pytest#13445): Made the type annotations of `pytest.skip` and friends more spec-complaint to have them work across more type checkers.

- [#&#8203;13537](pytest-dev/pytest#13537): Fixed a bug in which `ExceptionGroup` with only `Skipped` exceptions in teardown was not handled correctly and showed as error.

- [#&#8203;13598](pytest-dev/pytest#13598): Fixed possible collection confusion on Windows when short paths and symlinks are involved.

- [#&#8203;13716](pytest-dev/pytest#13716): Fixed a bug where a nonsensical invocation like `pytest x.py[a]` (a file cannot be parametrized) was silently treated as `pytest x.py`. This is now a usage error.

- [#&#8203;13722](pytest-dev/pytest#13722): Fixed a misleading assertion failure message when using `pytest.approx` on mappings with differing lengths.

- [#&#8203;13773](pytest-dev/pytest#13773): Fixed the static fixture closure calculation to properly consider transitive dependencies requested by overridden fixtures.

- [#&#8203;13816](pytest-dev/pytest#13816): Fixed `pytest.approx` which now returns a clearer error message when comparing mappings with different keys.

- [#&#8203;13849](pytest-dev/pytest#13849): Hidden `.pytest.ini` files are now picked up as the config file even if empty.
  This was an inconsistency with non-hidden `pytest.ini`.

- [#&#8203;13865](pytest-dev/pytest#13865): Fixed <span class="title-ref">--show-capture</span> with <span class="title-ref">--tb=line</span>.

- [#&#8203;13522](pytest-dev/pytest#13522): Fixed `pytester` in subprocess mode ignored all :attr\`pytester.plugins \<pytest.Pytester.plugins>\` except the first.

  Fixed `pytester` in subprocess mode silently ignored non-str `pytester.plugins <pytest.Pytester.plugins>`.
  Now it errors instead.
  If you are affected by this, specify the plugin by name, or switch the affected tests to use `pytester.runpytest_inprocess <pytest.Pytester.runpytest_inprocess>` explicitly instead.

#### Packaging updates and notes for downstreams

- [#&#8203;13791](pytest-dev/pytest#13791): Minimum requirements on `iniconfig` and `packaging` were bumped to `1.0.1` and `22.0.0`, respectively.

#### Contributor-facing changes

- [#&#8203;12244](pytest-dev/pytest#12244): Fixed self-test failures when <span class="title-ref">TERM=dumb</span>.
- [#&#8203;12474](pytest-dev/pytest#12474): Added scheduled GitHub Action Workflow to run Sphinx linkchecks in repo documentation.
- [#&#8203;13621](pytest-dev/pytest#13621): pytest's own testsuite now handles the `lsof` command hanging (e.g. due to unreachable network filesystems), with the affected selftests being skipped after 10 seconds.
- [#&#8203;13638](pytest-dev/pytest#13638): Fixed deprecated `gh pr new` command in `scripts/prepare-release-pr.py`.
  The script now uses `gh pr create` which is compatible with GitHub CLI v2.0+.
- [#&#8203;13695](pytest-dev/pytest#13695): Flush <span class="title-ref">stdout</span> and <span class="title-ref">stderr</span> in <span class="title-ref">Pytester.run</span> to avoid truncated outputs in <span class="title-ref">test\_faulthandler.py::test\_timeout</span> on CI -- by `ogrisel`.
- [#&#8203;13771](pytest-dev/pytest#13771): Skip <span class="title-ref">test\_do\_not\_collect\_symlink\_siblings</span> on Windows environments without symlink support to avoid false negatives.
- [#&#8203;13841](pytest-dev/pytest#13841): `tox>=4` is now required when contributing to pytest.
- [#&#8203;13625](pytest-dev/pytest#13625): Added missing docstrings to `pytest_addoption()`, `pytest_configure()`, and `cacheshow()` functions in `cacheprovider.py`.

#### Miscellaneous internal changes

- [#&#8203;13830](pytest-dev/pytest#13830): Configuration overrides (`-o`/`--override-ini`) are now processed during startup rather than during `config.getini() <pytest.Config.getini>`.

</details>

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yLjQiLCJ1cGRhdGVkSW5WZXIiOiI0My4yLjQiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbImRlcGVuZGVuY2llcyIsInJlbm92YXRlIl19-->

See merge request swiss-armed-forces/cyber-command/cea/loom!285

Co-authored-by: Loom MR Pipeline Trigger <group_103951964_bot_9504bb8dead6d4e406ad817a607f24be@noreply.gitlab.com>
Co-authored-by: open-source Pipeline <group_90701827_bot_ed04ae348bc5f40af9966fb8b6867e99@noreply.gitlab.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants