Skip to content

chore: migrate code from googleapis/python-datastore#13837

Open
chalmerlowe wants to merge 53 commits intomainfrom
python-datastore-migration
Open

chore: migrate code from googleapis/python-datastore#13837
chalmerlowe wants to merge 53 commits intomainfrom
python-datastore-migration

Conversation

@chalmerlowe
Copy link
Contributor

Description

Fixes #

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

jlara310 and others added 30 commits June 16, 2022 12:32
* docs: add samples for IN, NOT_IN, and != operators.

* Update samples/snippets_test.py

Co-authored-by: Mariatta Wijaya <Mariatta@users.noreply.github.com>

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* Add an index.yaml file with required indexes

* Fix linting errors. Remove unused libraries.

* Opt into build specific gcloud projects.

* Typo in code comment

* Add a test fixture to set up a required index.

* Remove snippets that require an index. Will add them in another PR.

* Fix linting error

* Create a snippets subdirectory under samples

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* Use build-specific gcloud projects for noxfile.

* Restore noxfile.py to owlbot version. Add noxfile_config.py

Co-authored-by: Mariatta Wijaya <Mariatta@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* chore(python): drop python 3.6

Source-Link: googleapis/synthtool@4f89b13
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e7bb19d47c13839fe8c147e50e02e8b6cf5da8edd1af8b82208cd6f66cc2829c

* add api_description to .repo-metadata.json

* require python 3.7+ in setup.py

* remove python 3.6 sample configs

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* remove python 3.6 from noxfile

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* remove python 3.6 from noxfile

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* ci: update replacement in owlbot.py

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* revert

* revert

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
…#342)

* Add an example of using read_time in queries and get()

* Fix test for query_with_readtime
Source-Link: googleapis/synthtool@50db768
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e09366bdf0fd9c8976592988390b24d53583dd9f002d476934da43725adbb978
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Source-Link: googleapis/synthtool@6ed3a83
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3abfa0f1886adaf0b83f07cb117b24a639ea1cb9cffe56d43280b977033563eb

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* Add samples for Count query

* Remove unused variable.

* Add count query samples with limit

* Fix the stale read test.

* Raise ValueError instead of general Exception
Source-Link: googleapis/synthtool@7197a00
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:c43f1d918bcf817d337aa29ff833439494a158a0831508fda4ec75dc4c0d0320

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Mariatta Wijaya <Mariatta@users.noreply.github.com>
renovate-bot and others added 14 commits September 18, 2023 10:29
* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* chore(python): Add Python 3.12

Source-Link: googleapis/synthtool@af16e6d
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bacc3af03bff793a03add584537b36b5644342931ad989e3ba1171d3bd5399f5

* Add python 3.12 to setup.py, constraints and required checks

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: Daniel Sanche <sanche@google.com>
* chore(deps): update all dependencies

* pin pytest for python 3.7

---------

Co-authored-by: Daniel Sanche <sanche@google.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
* chore(python): update dependencies in .kokoro/docker/docs

Source-Link: googleapis/synthtool@59171c8
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:2ed982f884312e4883e01b5ab8af8b6935f0216a5a2d82928d273081fc3be562

* Add constraints file for python 3.13

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
This PR adds support for Python 3.14 to the library.

Key changes include:
- Update to `.github/workflows` files to account for Python runtimes
both 3.14 and 3.8.
- Adding Python 3.14 to the test matrix in
`.github/workflows/unittest.yml`, etc.
- Updating `.github/sync-repo-settings.yaml` to include 3.14 unit tests
in required checks.
- Update to `.kokoro/presubmit` files to update the system test and
`presubmit.cfg`
- Adding `testing/constraints-3.14.txt`.
- Updates `CONTRIBUTING.rst` to list Python 3.14 as a supported version.
- Updates `mypy.ini` to suppress several known type hinting errors in
two files.
- Updating `noxfile.py` to include 3.14 sessions.
- Updates to `owlbot.py` to include Python 3.14.
- Updating `setup.py` to include the Python 3.14 classifier and add
conditional dependencies for `grpcio`.

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
> **Note:** This PR body was truncated due to platform limits.

This PR contains the following updates:

| Package | Type | Update | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|---|---|
| [actions/checkout](https://redirect.github.com/actions/checkout) |
action | major | `v4` → `v6` |
![age](https://developer.mend.io/api/mc/badges/age/github-tags/actions%2fcheckout/v6?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/github-tags/actions%2fcheckout/v4/v6?slim=true)
|
|
[actions/setup-python](https://redirect.github.com/actions/setup-python)
| action | major | `v5` → `v6` |
![age](https://developer.mend.io/api/mc/badges/age/github-tags/actions%2fsetup-python/v6?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/github-tags/actions%2fsetup-python/v5/v6?slim=true)
|
|
[google-cloud-datastore](https://redirect.github.com/googleapis/python-datastore)
| | minor | `==2.20.0` → `==2.23.0` |
![age](https://developer.mend.io/api/mc/badges/age/pypi/google-cloud-datastore/2.23.0?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/google-cloud-datastore/2.20.0/2.23.0?slim=true)
|
| [pytest](https://redirect.github.com/pytest-dev/pytest)
([changelog](https://docs.pytest.org/en/stable/changelog.html)) | |
major | `==8.3.2` → `==9.0.2` |
![age](https://developer.mend.io/api/mc/badges/age/pypi/pytest/9.0.2?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/pytest/8.3.2/9.0.2?slim=true)
|
| [python](https://redirect.github.com/actions/python-versions) |
uses-with | minor | `3.10` → `3.14` |
![age](https://developer.mend.io/api/mc/badges/age/github-releases/actions%2fpython-versions/3.14.2?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/github-releases/actions%2fpython-versions/3.10.19/3.14.2?slim=true)
|

---

### Release Notes

<details>
<summary>actions/checkout (actions/checkout)</summary>

### [`v6`](https://redirect.github.com/actions/checkout/compare/v5...v6)

[Compare
Source](https://redirect.github.com/actions/checkout/compare/v5...v6)

### [`v5`](https://redirect.github.com/actions/checkout/compare/v4...v5)

[Compare
Source](https://redirect.github.com/actions/checkout/compare/v4...v5)

</details>

<details>
<summary>actions/setup-python (actions/setup-python)</summary>

###
[`v6`](https://redirect.github.com/actions/setup-python/compare/v5...v6)

[Compare
Source](https://redirect.github.com/actions/setup-python/compare/v5...v6)

</details>

<details>
<summary>googleapis/python-datastore (google-cloud-datastore)</summary>

###
[`v2.23.0`](https://redirect.github.com/googleapis/python-datastore/blob/HEAD/CHANGELOG.md#2230-2025-12-16)

[Compare
Source](https://redirect.github.com/googleapis/python-datastore/compare/v2.22.0...v2.23.0)

##### Features

- support mTLS certificates when available
([#&#8203;658](https://redirect.github.com/googleapis/python-datastore/issues/658))
([85c023287daebb0d5c1a009e2beaccf0c6ea75eb](https://redirect.github.com/googleapis/python-datastore/commit/85c023287daebb0d5c1a009e2beaccf0c6ea75eb))

###
[`v2.22.0`](https://redirect.github.com/googleapis/python-datastore/blob/HEAD/CHANGELOG.md#2220-2025-12-12)

[Compare
Source](https://redirect.github.com/googleapis/python-datastore/compare/v2.21.0...v2.22.0)

##### Bug Fixes

- remove setup.cfg configuration for creating universal wheels
([#&#8203;601](https://redirect.github.com/googleapis/python-datastore/issues/601))
([df729015149bd69e9d6dbced260d97c8eed77d4f](https://redirect.github.com/googleapis/google-cloud-python/commit/df729015149bd69e9d6dbced260d97c8eed77d4f))

###
[`v2.21.0`](https://redirect.github.com/googleapis/python-datastore/blob/HEAD/CHANGELOG.md#2210-2025-04-10)

[Compare
Source](https://redirect.github.com/googleapis/python-datastore/compare/v2.20.2...v2.21.0)

##### Features

- Add REST Interceptors which support reading metadata
([7be9c4c](https://redirect.github.com/googleapis/python-datastore/commit/7be9c4c594af2c2414e394b8bfe62574b58ef337))
- Add support for opt-in debug logging
([7be9c4c](https://redirect.github.com/googleapis/python-datastore/commit/7be9c4c594af2c2414e394b8bfe62574b58ef337))

##### Bug Fixes

- Allow protobuf 6.x
([#&#8203;598](https://redirect.github.com/googleapis/python-datastore/issues/598))
([7c1171b](https://redirect.github.com/googleapis/python-datastore/commit/7c1171bf657f7cf4d1404e19611f6c874a8998ca))
- Backwards-compatibility for previous meaning format
([#&#8203;603](https://redirect.github.com/googleapis/python-datastore/issues/603))
([ed92e8e](https://redirect.github.com/googleapis/python-datastore/commit/ed92e8e54a9e0f44302efee89a30a322d0a73636))
- Fix typing issue with gRPC metadata when key ends in -bin
([7be9c4c](https://redirect.github.com/googleapis/python-datastore/commit/7be9c4c594af2c2414e394b8bfe62574b58ef337))

###
[`v2.20.2`](https://redirect.github.com/googleapis/python-datastore/blob/HEAD/CHANGELOG.md#2202-2024-12-12)

[Compare
Source](https://redirect.github.com/googleapis/python-datastore/compare/v2.20.1...v2.20.2)

##### Bug Fixes

- Preserve list meanings
([#&#8203;575](https://redirect.github.com/googleapis/python-datastore/issues/575))
([266243b](https://redirect.github.com/googleapis/python-datastore/commit/266243ba360a9d41ab4b51c323eac44d2cfc35cb))

###
[`v2.20.1`](https://redirect.github.com/googleapis/python-datastore/blob/HEAD/CHANGELOG.md#2201-2024-08-14)

[Compare
Source](https://redirect.github.com/googleapis/python-datastore/compare/v2.20.0...v2.20.1)

##### Bug Fixes

- Allow protobuf 5.x; require protobuf >=3.20.2
([#&#8203;560](https://redirect.github.com/googleapis/python-datastore/issues/560))
([ad50e36](https://redirect.github.com/googleapis/python-datastore/commit/ad50e3648954edf27575001be833bb5e1e598f46))

</details>

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

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

[Compare
Source](https://redirect.github.com/pytest-dev/pytest/compare/9.0.1...9.0.2)

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

#### Bug fixes

-
[#&#8203;13896](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13904):
Fixed the TOML type of the `tmp_path_retention_count` settings in the
API reference from number to string.

-
[#&#8203;13946](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13965):
Fixed quadratic-time behavior when handling `unittest` subtests in
Python 3.10.

#### Improved documentation

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

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

[Compare
Source](https://redirect.github.com/pytest-dev/pytest/compare/9.0.0...9.0.1)

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

#### Bug fixes

-
[#&#8203;13895](https://redirect.github.com/pytest-dev/pytest/issues/13895):
Restore support for skipping tests via `raise unittest.SkipTest`.
-
[#&#8203;13896](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13904):
Fixed the TOML type of the verbosity settings in the API reference from
number to string.
-
[#&#8203;13910](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13891),
[#&#8203;13942](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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://redirect.github.com/pytest-dev/pytest/releases/tag/9.0.0)

[Compare
Source](https://redirect.github.com/pytest-dev/pytest/compare/8.4.2...9.0.0)

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

#### New features

-
[#&#8203;1367](https://redirect.github.com/pytest-dev/pytest/issues/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://redirect.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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13719):
Support for Python 3.9 is dropped following its end of life.

-
[#&#8203;13766](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13445):
Made the type annotations of `pytest.skip` and friends more
spec-complaint to have them work across more type checkers.

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

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

-
[#&#8203;13716](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13722):
Fixed a misleading assertion failure message when using `pytest.approx`
on mappings with differing lengths.

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

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

-
[#&#8203;13849](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13865):
Fixed <span class="title-ref">--show-capture</span> with <span
class="title-ref">--tb=line</span>.

-
[#&#8203;13522](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13791):
Minimum requirements on `iniconfig` and `packaging` were bumped to
`1.0.1` and `22.0.0`, respectively.

#### Contributor-facing changes

-
[#&#8203;12244](https://redirect.github.com/pytest-dev/pytest/issues/12244):
Fixed self-test failures when <span class="title-ref">TERM=dumb</span>.
-
[#&#8203;12474](https://redirect.github.com/pytest-dev/pytest/issues/12474):
Added scheduled GitHub Action Workflow to run Sphinx linkchecks in repo
documentation.
-
[#&#8203;13621](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13841):
`tox>=4` is now required when contributing to pytest.
-
[#&#8203;13625](https://redirect.github.com/pytest-dev/pytest/issues/13625):
Added missing docstrings to `pytest_addoption()`, `pytest_configure()`,
and `cacheshow()` functions in `cacheprovider.py`.

#### Miscellaneous internal changes

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

###
[`v8.4.2`](https://redirect.github.com/pytest-dev/pytest/releases/tag/8.4.2)

[Compare
Source](https://redirect.github.com/pytest-dev/pytest/compare/8.4.1...8.4.2)

### pytest 8.4.2 (2025-09-03)

#### Bug fixes

-
[#&#8203;13478](https://redirect.github.com/pytest-dev/pytest/issues/13478):
Fixed a crash when using `console_output_style`{.interpreted-text
role="confval"} with `times` and a module is skipped.

-
[#&#8203;13530](https://redirect.github.com/pytest-dev/pytest/issues/13530):
Fixed a crash when using `pytest.approx`{.interpreted-text role="func"}
and `decimal.Decimal`{.interpreted-text role="class"} instances with the
`decimal.FloatOperation`{.interpreted-text role="class"} trap set.

-
[#&#8203;13549](https://redirect.github.com/pytest-dev/pytest/issues/13549):
No longer evaluate type annotations in Python `3.14` when inspecting
function signatures.

This prevents crashes during module collection when modules do not
explicitly use `from __future__ import annotations` and import types for
annotations within a `if TYPE_CHECKING:` block.

-
[#&#8203;13559](https://redirect.github.com/pytest-dev/pytest/issues/13559):
Added missing \[int]{.title-ref} and \[float]{.title-ref} variants to
the \[Literal]{.title-ref} type annotation of the \[type]{.title-ref}
parameter in `pytest.Parser.addini`{.interpreted-text role="meth"}.

-
[#&#8203;13563](https://redirect.github.com/pytest-dev/pytest/issues/13563):
`pytest.approx`{.interpreted-text role="func"} now only imports `numpy`
if NumPy is already in `sys.modules`. This fixes unconditional import
behavior introduced in \[8.4.0]{.title-ref}.

#### Improved documentation

-
[#&#8203;13577](https://redirect.github.com/pytest-dev/pytest/issues/13577):
Clarify that `pytest_generate_tests` is discovered in test
modules/classes; other hooks must be in `conftest.py` or plugins.

#### Contributor-facing changes

-
[#&#8203;13480](https://redirect.github.com/pytest-dev/pytest/issues/13480):
Self-testing: fixed a few test failures when run with `-Wdefault` or a
similar override.
-
[#&#8203;13547](https://redirect.github.com/pytest-dev/pytest/issues/13547):
Self-testing: corrected expected message for
`test_doctest_unexpected_exception` in Python `3.14`.
-
[#&#8203;13684](https://redirect.github.com/pytest-dev/pytest/issues/13684):
Make pytest's own testsuite insensitive to the presence of the `CI`
environment variable -- by `ogrisel`{.interpreted-text role="user"}.

###
[`v8.4.1`](https://redirect.github.com/pytest-dev/pytest/releases/tag/8.4.1)

[Compare
Source](https://redirect.github.com/pytest-dev/pytest/compare/8.4.0...8.4.1)

### pytest 8.4.1 (2025-06-17)

#### Bug fixes

-
[#&#8203;13461](https://redirect.github.com/pytest-dev/pytest/issues/13461):
Corrected `_pytest.terminal.TerminalReporter.isatty` to support
  being called as a method. Before it was just a boolean which could
  break correct code when using `-o log_cli=true`).

-
[#&#8203;13477](https://redirect.github.com/pytest-dev/pytest/issues/13477):
Reintroduced `pytest.PytestReturnNotNoneWarning`{.interpreted-text
role="class"} which was removed by accident in pytest
\[8.4]{.title-ref}.

This warning is raised when a test functions returns a value other than
`None`, which is often a mistake made by beginners.

See `return-not-none`{.interpreted-text role="ref"} for more
information.

-
[#&#8203;13497](https://redirect.github.com/pytest-dev/pytest/issues/13497):
Fixed compatibility with `Twisted 25+`.

#### Improved documentation

-
[#&#8203;13492](https://redirect.github.com/pytest-dev/pytest/issues/13492):
Fixed outdated warning about `faulthandler` not working on Windows.

###
[`v8.4.0`](https://redirect.github.com/pytest-dev/pytest/releases/tag/8.4.0)

[Compare
Source](https://redirect.github.com/pytest-dev/pytest/compare/8.3.5...8.4.0)

### pytest 8.4.0 (2025-06-02)

#### Removals and backward incompatible breaking changes

-
[#&#8203;11372](https://redirect.github.com/pytest-dev/pytest/issues/11372):
Async tests will now fail, instead of warning+skipping, if you don't
have any suitable plugin installed.

-
[#&#8203;12346](https://redirect.github.com/pytest-dev/pytest/issues/12346):
Tests will now fail, instead of raising a warning, if they return any
value other than None.

-
[#&#8203;12874](https://redirect.github.com/pytest-dev/pytest/issues/12874):
We dropped support for Python 3.8 following its end of life
(2024-10-07).

-
[#&#8203;12960](https://redirect.github.com/pytest-dev/pytest/issues/12960):
Test functions containing a yield now cause an explicit error. They have
not been run since pytest 4.0, and were previously marked as an expected
failure and deprecation warning.

See `the docs <yield tests deprecated>`{.interpreted-text role="ref"}
for more information.

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

-
[#&#8203;10839](https://redirect.github.com/pytest-dev/pytest/issues/10839):
Requesting an asynchronous fixture without a
\[pytest\_fixture\_setup]{.title-ref} hook that resolves it will now
give a DeprecationWarning. This most commonly happens if a sync test
requests an async fixture. This should have no effect on a majority of
users with async tests or fixtures using async pytest plugins, but may
affect non-standard hook setups or `autouse=True`. For guidance on how
to work around this warning see
`sync-test-async-fixture`{.interpreted-text role="ref"}.

#### New features

-
[#&#8203;11538](https://redirect.github.com/pytest-dev/pytest/issues/11538):
Added `pytest.RaisesGroup`{.interpreted-text role="class"} as an
equivalent to `pytest.raises`{.interpreted-text role="func"} for
expecting `ExceptionGroup`{.interpreted-text role="exc"}. Also adds
`pytest.RaisesExc`{.interpreted-text role="class"} which is now the
logic behind `pytest.raises`{.interpreted-text role="func"} and used as
parameter to `pytest.RaisesGroup`{.interpreted-text role="class"}.
`RaisesGroup` includes the ability to specify multiple different
expected exceptions, the structure of nested exception groups, and flags
for emulating `except* <except_star>`{.interpreted-text role="ref"}. See
`assert-matching-exception-groups`{.interpreted-text role="ref"} and
docstrings for more information.

-
[#&#8203;12081](https://redirect.github.com/pytest-dev/pytest/issues/12081):
Added `capteesys`{.interpreted-text role="fixture"} to capture AND pass
output to next handler set by `--capture=`.

-
[#&#8203;12504](https://redirect.github.com/pytest-dev/pytest/issues/12504):
`pytest.mark.xfail`{.interpreted-text role="func"} now accepts
`pytest.RaisesGroup`{.interpreted-text role="class"} for the `raises`
parameter when you expect an exception group. You can also pass a
`pytest.RaisesExc`{.interpreted-text role="class"} if you e.g. want to
make use of the `check` parameter.

-
[#&#8203;12713](https://redirect.github.com/pytest-dev/pytest/issues/12713):
New \[--force-short-summary]{.title-ref} option to force condensed
summary output regardless of verbosity level.

This lets users still see condensed summary output of failures for quick
reference in log files from job outputs, being especially useful if
non-condensed output is very verbose.

-
[#&#8203;12749](https://redirect.github.com/pytest-dev/pytest/issues/12749):
pytest traditionally collects classes/functions in the test module
namespace even if they are imported from another file.

  For example:

  ```python
  ```

### contents of src/domain.py

```
class Testament: ...
```

### contents of tests/test\_testament.py

````
from domain import Testament

def test_testament(): ...
```

In this scenario with the default options, pytest will collect the class
[Testament]{.title-ref} from [tests/test_testament.py]{.title-ref}
because it starts with [Test]{.title-ref}, even though in this case it
is a production class being imported in the test module namespace.

This behavior can now be prevented by setting the new
`collect_imported_tests`{.interpreted-text role="confval"} configuration
option to `false`, which will make pytest collect classes/functions from
test files **only** if they are defined in that file.

\-- by `FreerGit`{.interpreted-text role="user"}
````

- [#&#8203;12765](https://redirect.github.com/pytest-dev/pytest/issues/12765): Thresholds to trigger snippet truncation can now be set with `truncation_limit_lines`{.interpreted-text role="confval"} and `truncation_limit_chars`{.interpreted-text role="confval"}.

  See `truncation-params`{.interpreted-text role="ref"} for more information.

- [#&#8203;13125](https://redirect.github.com/pytest-dev/pytest/issues/13125): `console_output_style`{.interpreted-text role="confval"} now supports `times` to show execution time of each test.

- [#&#8203;13192](https://redirect.github.com/pytest-dev/pytest/issues/13192): `pytest.raises`{.interpreted-text role="func"} will now raise a warning when passing an empty string to `match`, as this will match against any value. Use `match="^$"` if you want to check that an exception has no message.

- [#&#8203;13192](https://redirect.github.com/pytest-dev/pytest/issues/13192): `pytest.raises`{.interpreted-text role="func"} will now print a helpful string diff if matching fails and the match parameter has `^` and `$` and is otherwise escaped.

- [#&#8203;13192](https://redirect.github.com/pytest-dev/pytest/issues/13192): You can now pass `with pytest.raises(check=fn): <pytest.raises>`{.interpreted-text role="func"}, where `fn` is a function which takes a raised exception and returns a boolean. The `raises` fails if no exception was raised (as usual), passes if an exception is raised and `fn` returns `True` (as well as `match` and the type matching, if specified, which are checked before), and propagates the exception if `fn` returns `False` (which likely also fails the test).

- [#&#8203;13228](https://redirect.github.com/pytest-dev/pytest/issues/13228): `hidden-param`{.interpreted-text role="ref"} can now be used in `id` of `pytest.param`{.interpreted-text role="func"} or in
  `ids` of `Metafunc.parametrize <pytest.Metafunc.parametrize>`{.interpreted-text role="py:func"}.
  It hides the parameter set from the test name.

- [#&#8203;13253](https://redirect.github.com/pytest-dev/pytest/issues/13253): New flag: `--disable-plugin-autoload <disable_plugin_autoload>`{.interpreted-text role="ref"} which works as an alternative to `PYTEST_DISABLE_PLUGIN_AUTOLOAD`{.interpreted-text role="envvar"} when setting environment variables is inconvenient; and allows setting it in config files with `addopts`{.interpreted-text role="confval"}.

#### Improvements in existing functionality

- [#&#8203;10224](https://redirect.github.com/pytest-dev/pytest/issues/10224): pytest's `short` and `long` traceback styles (`how-to-modifying-python-tb-printing`{.interpreted-text role="ref"})
  now have partial `657`{.interpreted-text role="pep"} support and will show specific code segments in the
  traceback.

  ```pytest
  ================================= FAILURES =================================
  _______________________ test_gets_correct_tracebacks _______________________

  test_tracebacks.py:12: in test_gets_correct_tracebacks
      assert manhattan_distance(p1, p2) == 1
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  test_tracebacks.py:6: in manhattan_distance
      return abs(point_1.x - point_2.x) + abs(point_1.y - point_2.y)
                             ^^^^^^^^^
  E   AttributeError: 'NoneType' object has no attribute 'x'
  ```

  \-- by `ammaraskar`{.interpreted-text role="user"}

- [#&#8203;11118](https://redirect.github.com/pytest-dev/pytest/issues/11118): Now `pythonpath`{.interpreted-text role="confval"} configures \[$PYTHONPATH]{.title-ref} earlier than before during the initialization process, which now also affects plugins loaded via the \[-p]{.title-ref} command-line option.

  \-- by `millerdev`{.interpreted-text role="user"}

- [#&#8203;11381](https://redirect.github.com/pytest-dev/pytest/issues/11381): The `type` parameter of the `parser.addini` method now accepts \["int"]{.title-ref} and `"float"` parameters, facilitating the parsing of configuration values in the configuration file.

  Example:

  ```python
  def pytest_addoption(parser):
      parser.addini("int_value", type="int", default=2, help="my int value")
      parser.addini("float_value", type="float", default=4.2, help="my float value")
  ```

  The \[pytest.ini]{.title-ref} file:

  ```ini
  [pytest]
  int_value = 3
  float_value = 5.4
  ```

- [#&#8203;11525](https://redirect.github.com/pytest-dev/pytest/issues/11525): Fixtures are now clearly represented in the output as a "fixture object", not as a normal function as before, making it easy for beginners to catch mistakes such as referencing a fixture declared in the same module but not requested in the test function.

  \-- by `the-compiler`{.interpreted-text role="user"} and `glyphack`{.interpreted-text role="user"}

- [#&#8203;12426](https://redirect.github.com/pytest-dev/pytest/issues/12426): A warning is now issued when `pytest.mark.usefixtures ref`{.interpreted-text role="ref"} is used without specifying any fixtures. Previously, empty usefixtures markers were silently ignored.

- [#&#8203;12707](https://redirect.github.com/pytest-dev/pytest/issues/12707): Exception chains can be navigated when dropped into Pdb in Python 3.13+.

- [#&#8203;12736](https://redirect.github.com/pytest-dev/pytest/issues/12736): Added a new attribute \[name]{.title-ref} with the fixed value \["pytest tests"]{.title-ref} to the root tag \[testsuites]{.title-ref} of the junit-xml generated by pytest.

  This attribute is part of many junit-xml specifications and is even part of the \[junit-10.xsd]{.title-ref} specification that pytest's implementation is based on.

- [#&#8203;12943](https://redirect.github.com/pytest-dev/pytest/issues/12943): If a test fails with an exceptiongroup with a single exception, the contained exception will now be displayed in the short test summary info.

- [#&#8203;12958](https://redirect.github.com/pytest-dev/pytest/issues/12958): A number of `unraisable <unraisable>`{.interpreted-text role="ref"} enhancements:

  - Set the unraisable hook as early as possible and unset it as late as possible, to collect the most possible number of unraisable exceptions.
  - Call the garbage collector just before unsetting the unraisable hook, to collect any straggling exceptions.
  - Collect multiple unraisable exceptions per test phase.
  - Report the `tracemalloc`{.interpreted-text role="mod"} allocation traceback (if available).
  - Avoid using a generator based hook to allow handling `StopIteration`{.interpreted-text role="class"} in test failures.
  - Report the unraisable exception as the cause of the `pytest.PytestUnraisableExceptionWarning`{.interpreted-text role="class"} exception if raised.
  - Compute the `repr` of the unraisable object in the unraisable hook so you get the latest information if available, and should help with resurrection of the object.

- [#&#8203;13010](https://redirect.github.com/pytest-dev/pytest/issues/13010): `pytest.approx`{.interpreted-text role="func"} now can compare collections that contain numbers and non-numbers mixed.

- [#&#8203;13016](https://redirect.github.com/pytest-dev/pytest/issues/13016): A number of `threadexception <unraisable>`{.interpreted-text role="ref"} enhancements:

  - Set the excepthook as early as possible and unset it as late as possible, to collect the most possible number of unhandled exceptions from threads.
  - Collect multiple thread exceptions per test phase.
  - Report the `tracemalloc`{.interpreted-text role="mod"} allocation traceback (if available).
  - Avoid using a generator based hook to allow handling `StopIteration`{.interpreted-text role="class"} in test failures.
  - Report the thread exception as the cause of the `pytest.PytestUnhandledThreadExceptionWarning`{.interpreted-text role="class"} exception if raised.
  - Extract the `name` of the thread object in the excepthook which should help with resurrection of the thread.

- [#&#8203;13031](https://redirect.github.com/pytest-dev/pytest/issues/13031): An empty parameter set as in `pytest.mark.parametrize([], ids=idfunc)` will no longer trigger a call to `idfunc` with internal objects.

- [#&#8203;13115](https://redirect.github.com/pytest-dev/pytest/issues/13115): Allows supplying `ExceptionGroup[Exception]` and `BaseExceptionGroup[BaseException]` to `pytest.raises` to keep full typing on `ExceptionInfo <pytest.ExceptionInfo>`{.interpreted-text role="class"}:

  ```python
  with pytest.raises(ExceptionGroup[Exception]) as exc_info:
      some_function()
  ```

  Parametrizing with other exception types remains an error - we do not check the types of child exceptions and thus do not permit code that might look like we do.

- [#&#8203;13122](https://redirect.github.com/pytest-dev/pytest/issues/13122): The `--stepwise` mode received a number of improvements:

  - It no longer forgets the last failed test in case pytest is executed later without the flag.

    This enables the following workflow:

    1. Execute pytest with `--stepwise`, pytest then stops at the first failing test;
    2. Iteratively update the code and run the test in isolation, without the `--stepwise` flag (for example in an IDE), until it is fixed.
    3. Execute pytest with `--stepwise` again and pytest will continue from the previously failed test, and if it passes, continue on to the next tests.

    Previously, at step 3, pytest would start from the beginning, forgetting the previously failed test.

    This change however might cause issues if the `--stepwise` mode is used far apart in time, as the state might get stale, so the internal state will be reset automatically in case the test suite changes (for now only the number of tests are considered for this, we might change/improve this on the future).

  - New `--stepwise-reset`/`--sw-reset` flag, allowing the user to explicitly reset the stepwise state and restart the workflow from the beginning.

- [#&#8203;13308](https://redirect.github.com/pytest-dev/pytest/issues/13308): Added official support for Python 3.14.

- [#&#8203;13380](https://redirect.github.com/pytest-dev/pytest/issues/13380): Fix `ExceptionGroup`{.interpreted-text role="class"} traceback filtering to exclude pytest internals.

- [#&#8203;13415](https://redirect.github.com/pytest-dev/pytest/issues/13415): The author metadata of the BibTex example is now correctly formatted with last names following first names.
  An example of BibLaTex has been added.
  BibTex and BibLaTex examples now clearly indicate that what is cited is software.

  \-- by `willynilly`{.interpreted-text role="user"}

- [#&#8203;13420](https://redirect.github.com/pytest-dev/pytest/issues/13420): Improved test collection performance by optimizing path resolution used in `FSCollector`.

- [#&#8203;13457](https://redirect.github.com/pytest-dev/pytest/issues/13457): The error message about duplicate parametrization no longer displays an internal stack trace.

- [#&#8203;4112](https://redirect.github.com/pytest-dev/pytest/issues/4112): Using `pytest.mark.usefixtures <pytest.mark.usefixtures ref>`{.interpreted-text role="ref"} on `pytest.param`{.interpreted-text role="func"} now produces an error instead of silently doing nothing.

- [#&#8203;5473](https://redirect.github.com/pytest-dev/pytest/issues/5473): Replace \[:]{.title-ref} with \[;]{.title-ref} in the assertion rewrite warning message so it can be filtered using standard Python warning filters before calling `pytest.main`{.interpreted-text role="func"}.

-

```

[#&#8203;6985](https://redirect.github.com/pytest-dev/pytest/issues/6985):
Improved `pytest.approx`{.interpreted-text role="func"} to enhance the
readability of value ranges and tolerances between 0.001 and 1000.
```

````
: - The [repr]{.title-ref} method now provides clearer output for values
within those ranges, making it easier to interpret the results.

- Previously, the output for those ranges of values and tolerances was
displayed in scientific notation (e.g., [42 ± 1.0e+00]{.title-ref}). The
updated method now presents the tolerance as a decimal for better
readability (e.g., [42 ± 1]{.title-ref}).

        Example:

        **Previous Output:**

        ``` console
        >>> pytest.approx(42, abs=1)
        42 ± 1.0e+00
        ```

        **Current Output:**

        ``` console
        >>> pytest.approx(42, abs=1)
        42 ± 1
        ```

    \-- by `fazeelghafoor`{.interpreted-text role="user"}
````

- [#&#8203;7683](https://redirect.github.com/pytest-dev/pytest/issues/7683): The formerly optional `pygments` dependency is now required, causing output always to be source-highlighted (unless disabled via the `--code-highlight=no` CLI option).

#### Bug fixes

- [#&#8203;10404](https://redirect.github.com/pytest-dev/pytest/issues/10404): Apply filterwarnings from config/cli as soon as possible, and revert them as late as possible
  so that warnings as errors are collected throughout the pytest run and before the
  unraisable and threadexcept hooks are removed.

  This allows very late warnings and unraisable/threadexcept exceptions to fail the test suite.

  This also changes the warning that the lsof plugin issues from PytestWarning to the new warning PytestFDWarning so it can be more easily filtered.

- [#&#8203;11067](https://redirect.github.com/pytest-dev/pytest/issues/11067): The test report is now consistent regardless if the test xfailed via `pytest.mark.xfail <pytest.mark.xfail ref>`{.interpreted-text role="ref"} or `pytest.fail`{.interpreted-text role="func"}.

  Previously, *xfailed* tests via the marker would have the string `"reason: "` prefixed to the message, while those *xfailed* via the function did not. The prefix has been removed.

- [#&#8203;12008](https://redirect.github.com/pytest-dev/pytest/issues/12008): In `11220`{.interpreted-text role="pr"}, an unintended change in reordering was introduced by changing the way indices were assigned to direct params. More specifically, before that change, the indices of direct params to metafunc's callspecs were assigned after all parametrizations took place. Now, that change is reverted.

- [#&#8203;12863](https://redirect.github.com/pytest-dev/pytest/issues/12863): Fix applying markers, including `pytest.mark.parametrize <pytest.mark.parametrize ref>`{.interpreted-text role="ref"} when placed above \[[@&#8203;staticmethod](https://redirect.github.com/staticmethod)]{.title-ref} or \[[@&#8203;classmethod](https://redirect.github.com/classmethod)]{.title-ref}.

- [#&#8203;12929](https://redirect.github.com/pytest-dev/pytest/issues/12929): Handle StopIteration from test cases, setup and teardown correctly.

- [#&#8203;12938](https://redirect.github.com/pytest-dev/pytest/issues/12938): Fixed `--durations-min` argument not respected if `-vv` is used.

- [#&#8203;12946](https://redirect.github.com/pytest-dev/pytest/issues/12946): Fixed missing help for `pdb`{.interpreted-text role="mod"} commands wrapped by pytest -- by `adamchainz`{.interpreted-text role="user"}.

- [#&#8203;12981](https://redirect.github.com/pytest-dev/pytest/issues/12981): Prevent exceptions in `pytest.Config.add_cleanup`{.interpreted-text role="func"} callbacks preventing further cleanups.

- [#&#8203;13047](https://redirect.github.com/pytest-dev/pytest/issues/13047): Restore `pytest.approx`{.interpreted-text role="func"} handling of equality checks between \[bool]{.title-ref} and \[numpy.bool\_]{.title-ref} types.

  Comparing \[bool]{.title-ref} and \[numpy.bool\_]{.title-ref} using `pytest.approx`{.interpreted-text role="func"} accidentally changed in version \[8.3.4]{.title-ref} and \[8.3.5]{.title-ref} to no longer match:

  ```pycon
  >>> import numpy as np
  >>> from pytest import approx
  >>> [np.True_, np.True_] == pytest.approx([True, True])
  False
  ```

  This has now been fixed:

  ```pycon
  >>> [np.True_, np.True_] == pytest.approx([True, True])
  True
  ```

- [#&#8203;13119](https://redirect.github.com/pytest-dev/pytest/issues/13119): Improved handling of invalid regex patterns for filter warnings by providing a clear error message.

- [#&#8203;13175](https://redirect.github.com/pytest-dev/pytest/issues/13175): The diff is now also highlighted correctly when comparing two strings.

- [#&#8203;13248](https://redirect.github.com/pytest-dev/pytest/issues/13248): Fixed an issue where passing a `scope` in `Metafunc.parametrize <pytest.Metafunc.parametrize>`{.interpreted-text role="py:func"} with `indirect=True`
  could result in other fixtures being unable to depend on the parametrized fixture.

- [#&#8203;13291](https://redirect.github.com/pytest-dev/pytest/issues/13291): Fixed `repr` of `attrs` objects in assertion failure messages when using `attrs>=25.2`.

- [#&#8203;13312](https://redirect.github.com/pytest-dev/pytest/issues/13312): Fixed a possible `KeyError` crash on PyPy during collection of tests involving higher-scoped parameters.

- [#&#8203;13345](https://redirect.github.com/pytest-dev/pytest/issues/13345): Fix type hints for `pytest.TestReport.when`{.interpreted-text role="attr"} and `pytest.TestReport.location`{.interpreted-text role="attr"}.

- [#&#8203;13377](https://redirect.github.com/pytest-dev/pytest/issues/13377): Fixed handling of test methods with positional-only parameter syntax.

  Now, methods are supported that formally define `self` as positional-only
  and/or fixture parameters as keyword-only, e.g.:

  ```python
  class TestClass:

      def test_method(self, /, *, fixture): ...
  ```

  Before, this caused an internal error in pytest.

- [#&#8203;13384](https://redirect.github.com/pytest-dev/pytest/issues/13384): Fixed an issue where pytest could report negative durations.

- [#&#8203;13420](https://redirect.github.com/pytest-dev/pytest/issues/13420): Added `lru_cache` to `nodes._check_initialpaths_for_relpath`.

- [#&#8203;9037](https://redirect.github.com/pytest-dev/pytest/issues/9037): Honor `disable_test_id_escaping_and_forfeit_all_rights_to_community_support`{.interpreted-text role="confval"} when escaping ids in parametrized tests.

#### Improved documentation

- [#&#8203;12535](https://redirect.github.com/pytest-dev/pytest/issues/12535): \[This
  example]{.title-ref}<<https://docs.pytest.org/en/latest/example/simple.html#making-test-result-information-available-in-fixtures>>
  showed `print` statements that do not exactly reflect what the
  different branches actually do. The fix makes the example more precise.

- [#&#8203;13218](https://redirect.github.com/pytest-dev/pytest/issues/13218): Pointed out in the `pytest.approx`{.interpreted-text role="func"} documentation that it considers booleans unequal to numeric zero or one.

- [#&#8203;13221](https://redirect.github.com/pytest-dev/pytest/issues/13221): Improved grouping of CLI options in the `--help` output.

- [#&#8203;6649](https://redirect.github.com/pytest-dev/pytest/issues/6649): Added `~pytest.TerminalReporter`{.interpreted-text role="class"} to the `api-reference`{.interpreted-text role="ref"} documentation page.

- [#&#8203;8612](https://redirect.github.com/pytest-dev/pytest/issues/8612): Add a recipe for handling abstract test classes in the documentation.

  A new example has been added to the documentation to demonstrate how to use a mixin class to handle abstract
  test classes without manually setting the `__test__` attribute for subclasses.
  This ensures that subclasses of abstract test classes are automatically collected by pytest.

#### Packaging updates and notes for downstreams

- [#&#8203;13317](https://redirect.github.com/pytest-dev/pytest/issues/13317): Specified minimum allowed versions of `colorama`, `iniconfig`,
  and `packaging`; and bumped the minimum allowed version
  of `exceptiongroup` for `python_version<'3.11'` from a release
  candidate to a full release.

#### Contributor-facing changes

- [#&#8203;12017](https://redirect.github.com/pytest-dev/pytest/issues/12017): Mixed internal improvements:

  - Migrate formatting to f-strings in some tests.
  - Use type-safe constructs in JUnitXML tests.
  - Moved`MockTiming` into `_pytest.timing`.

  \-- by `RonnyPfannschmidt`{.interpreted-text role="user"}

- [#&#8203;12647](https://redirect.github.com/pytest-dev/pytest/issues/12647): Fixed running the test suite with the `hypothesis` pytest plugin.

#### Miscellaneous internal changes

- [#&#8203;6649](https://redirect.github.com/pytest-dev/pytest/issues/6649): Added `~pytest.TerminalReporter`{.interpreted-text role="class"} to the public pytest API, as it is part of the signature of the `pytest_terminal_summary`{.interpreted-text role="hook"} hook.

### [`v8.3.5`](https://redirect.github.com/pytest-dev/pytest/releases/tag/8.3.5)

[Compare Source](https://redirect.github.com/pytest-dev/pytest/compare/8.3.4...8.3.5)

### pytest 8.3.5 (2025-03-02)

#### Bug fixes

- [#&#8203;11777](https://redirect.github.com/pytest-dev/pytest/issues/11777): Fixed issue where sequences were still being shortened even with `-vv` verbosity.
- [#&#8203;12888](https://redirect.github.com/pytest-dev/pytest/issues/12888): Fixed broken input when using Python 3.13+ and a `libedit` build of Python, such as on macOS or with uv-managed Python binaries from the `python-build-standalone` project. This could manifest e.g. by a broken prompt when using `Pdb`, or seeing empty inputs with manual usage of `input()` and suspended capturing.
- [#&#8203;13026](https://redirect.github.com/pytest-dev/pytest/issues/13026): Fixed `AttributeError`{.interpreted-text role="class"} crash when using `--import-mode=importlib` when top-level directory same name as another module of the standard library.
- [#&#8203;13053](https://redirect.github.com/pytest-dev/pytest/issues/13053): Fixed a regression in pytest 8.3.4 where, when using `--import-mode=importlib`, a directory containing py file with the same name would cause an `ImportError`
- [#&#8203;13083](https://redirect.github.com/pytest-dev/pytest/issues/13083): Fixed issue where pytest could crash if one of the collected directories got removed during collection.

#### Improved documentation

- [#&#8203;12842](https://redirect.github.com/pytest-dev/pytest/issues/12842): Added dedicated page about using types with pytest.

  See `types`{.interpreted-text role="ref"} for detailed usage.

#### Contributor-facing changes

- [#&#8203;13112](https://redirect.github.com/pytest-dev/pytest/issues/13112): Fixed selftest failures in `test_terminal.py` with Pygments >= 2.19.0
- [#&#8203;13256](https://redirect.github.com/pytest-dev/pytest/issues/13256): Support for Towncrier versions released in 2024 has been re-enabled
  when building Sphinx docs -- by `webknjaz`{.interpreted-text role="user"}.

### [`v8.3.4`](https://redirect.github.com/pytest-dev/pytest/releases/tag/8.3.4)

[Compare Source](https://redirect.github.com/pytest-dev/pytest/compare/8.3.3...8.3.4)

### pytest 8.3.4 (2024-12-01)

#### Bug fixes

- [#&#8203;12592](https://redirect.github.com/pytest-dev/pytest/issues/12592): Fixed `KeyError`{.interpreted-text role="class"} crash when using `--import-mode=importlib` in a directory l

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired.

---

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

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/googleapis/python-datastore).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi43NC41IiwidXBkYXRlZEluVmVyIjoiNDIuNzQuNSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

---------

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) | Type |
Update |
|---|---|---|---|---|---|
| [pytest](https://redirect.github.com/pytest-dev/pytest)
([changelog](https://docs.pytest.org/en/stable/changelog.html)) |
`==8.4.2` → `==9.0.2` |
![age](https://developer.mend.io/api/mc/badges/age/pypi/pytest/9.0.2?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/pytest/8.4.2/9.0.2?slim=true)
| | major |
| [python](https://redirect.github.com/actions/python-versions) | `3.10`
→ `3.14` |
![age](https://developer.mend.io/api/mc/badges/age/github-releases/actions%2fpython-versions/3.14.3?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/github-releases/actions%2fpython-versions/3.10.19/3.14.3?slim=true)
| uses-with | minor |

---

### Release Notes

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

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

[Compare
Source](https://redirect.github.com/pytest-dev/pytest/compare/9.0.1...9.0.2)

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

#### Bug fixes

-
[#&#8203;13896](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13904):
Fixed the TOML type of the `tmp_path_retention_count` settings in the
API reference from number to string.

-
[#&#8203;13946](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13965):
Fixed quadratic-time behavior when handling `unittest` subtests in
Python 3.10.

#### Improved documentation

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

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

[Compare
Source](https://redirect.github.com/pytest-dev/pytest/compare/9.0.0...9.0.1)

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

#### Bug fixes

-
[#&#8203;13895](https://redirect.github.com/pytest-dev/pytest/issues/13895):
Restore support for skipping tests via `raise unittest.SkipTest`.
-
[#&#8203;13896](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13904):
Fixed the TOML type of the verbosity settings in the API reference from
number to string.
-
[#&#8203;13910](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13891),
[#&#8203;13942](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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://redirect.github.com/pytest-dev/pytest/releases/tag/9.0.0)

[Compare
Source](https://redirect.github.com/pytest-dev/pytest/compare/8.4.2...9.0.0)

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

#### New features

-
[#&#8203;1367](https://redirect.github.com/pytest-dev/pytest/issues/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://redirect.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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13719):
Support for Python 3.9 is dropped following its end of life.

-
[#&#8203;13766](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13445):
Made the type annotations of `pytest.skip` and friends more
spec-complaint to have them work across more type checkers.

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

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

-
[#&#8203;13716](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13722):
Fixed a misleading assertion failure message when using `pytest.approx`
on mappings with differing lengths.

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

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

-
[#&#8203;13849](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13865):
Fixed <span class="title-ref">--show-capture</span> with <span
class="title-ref">--tb=line</span>.

-
[#&#8203;13522](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13791):
Minimum requirements on `iniconfig` and `packaging` were bumped to
`1.0.1` and `22.0.0`, respectively.

#### Contributor-facing changes

-
[#&#8203;12244](https://redirect.github.com/pytest-dev/pytest/issues/12244):
Fixed self-test failures when <span class="title-ref">TERM=dumb</span>.
-
[#&#8203;12474](https://redirect.github.com/pytest-dev/pytest/issues/12474):
Added scheduled GitHub Action Workflow to run Sphinx linkchecks in repo
documentation.
-
[#&#8203;13621](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/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](https://redirect.github.com/pytest-dev/pytest/issues/13841):
`tox>=4` is now required when contributing to pytest.
-
[#&#8203;13625](https://redirect.github.com/pytest-dev/pytest/issues/13625):
Added missing docstrings to `pytest_addoption()`, `pytest_configure()`,
and `cacheshow()` functions in `cacheprovider.py`.

#### Miscellaneous internal changes

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

</details>

<details>
<summary>actions/python-versions (python)</summary>

###
[`v3.14.3`](https://redirect.github.com/actions/python-versions/releases/tag/3.14.3-21673711214):
3.14.3

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.14.2-20014991423...3.14.3-21673711214)

Python 3.14.3

###
[`v3.14.2`](https://redirect.github.com/actions/python-versions/releases/tag/3.14.2-20014991423):
3.14.2

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.14.1-19879739908...3.14.2-20014991423)

Python 3.14.2

###
[`v3.14.1`](https://redirect.github.com/actions/python-versions/releases/tag/3.14.1-19879739908):
3.14.1

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.14.0-18313368925...3.14.1-19879739908)

Python 3.14.1

###
[`v3.14.0`](https://redirect.github.com/actions/python-versions/releases/tag/3.14.0-18313368925):
3.14.0

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.13.12-21673645133...3.14.0-18313368925)

Python 3.14.0

###
[`v3.13.12`](https://redirect.github.com/actions/python-versions/releases/tag/3.13.12-21673645133):
3.13.12

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.13.11-20014977833...3.13.12-21673645133)

Python 3.13.12

###
[`v3.13.11`](https://redirect.github.com/actions/python-versions/releases/tag/3.13.11-20014977833):
3.13.11

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.13.10-19879712315...3.13.11-20014977833)

Python 3.13.11

###
[`v3.13.10`](https://redirect.github.com/actions/python-versions/releases/tag/3.13.10-19879712315):
3.13.10

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.13.9-18515951191...3.13.10-19879712315)

Python 3.13.10

###
[`v3.13.9`](https://redirect.github.com/actions/python-versions/releases/tag/3.13.9-18515951191):
3.13.9

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.13.8-18331000654...3.13.9-18515951191)

Python 3.13.9

###
[`v3.13.8`](https://redirect.github.com/actions/python-versions/releases/tag/3.13.8-18331000654):
3.13.8

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.13.7-16980743123...3.13.8-18331000654)

Python 3.13.8

###
[`v3.13.7`](https://redirect.github.com/actions/python-versions/releases/tag/3.13.7-16980743123):
3.13.7

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.13.6-16792117939...3.13.7-16980743123)

Python 3.13.7

###
[`v3.13.6`](https://redirect.github.com/actions/python-versions/releases/tag/3.13.6-16792117939):
3.13.6

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.13.5-15601068749...3.13.6-16792117939)

Python 3.13.6

###
[`v3.13.5`](https://redirect.github.com/actions/python-versions/releases/tag/3.13.5-15601068749):
3.13.5

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.13.4-15433317575...3.13.5-15601068749)

Python 3.13.5

###
[`v3.13.4`](https://redirect.github.com/actions/python-versions/releases/tag/3.13.4-15433317575):
3.13.4

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.13.3-14344076652...3.13.4-15433317575)

Python 3.13.4

###
[`v3.13.3`](https://redirect.github.com/actions/python-versions/releases/tag/3.13.3-14344076652):
3.13.3

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.13.2-13708744326...3.13.3-14344076652)

Python 3.13.3

###
[`v3.13.2`](https://redirect.github.com/actions/python-versions/releases/tag/3.13.2-13708744326):
3.13.2

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.13.1-13437882550...3.13.2-13708744326)

Python 3.13.2

###
[`v3.13.1`](https://redirect.github.com/actions/python-versions/releases/tag/3.13.1-13437882550):
3.13.1

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.13.0-13707372259...3.13.1-13437882550)

Python 3.13.1

###
[`v3.13.0`](https://redirect.github.com/actions/python-versions/releases/tag/3.13.0-13707372259):
3.13.0

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.12.12-18393146713...3.13.0-13707372259)

Python 3.13.0

###
[`v3.12.12`](https://redirect.github.com/actions/python-versions/releases/tag/3.12.12-18393146713):
3.12.12

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.12.11-15433310049...3.12.12-18393146713)

Python 3.12.12

###
[`v3.12.11`](https://redirect.github.com/actions/python-versions/releases/tag/3.12.11-15433310049):
3.12.11

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.12.10-14343898437...3.12.11-15433310049)

Python 3.12.11

###
[`v3.12.10`](https://redirect.github.com/actions/python-versions/releases/tag/3.12.10-14343898437):
3.12.10

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.12.9-13149478207...3.12.10-14343898437)

Python 3.12.10

###
[`v3.12.9`](https://redirect.github.com/actions/python-versions/releases/tag/3.12.9-13149478207):
3.12.9

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.12.8-12154062663...3.12.9-13149478207)

Python 3.12.9

###
[`v3.12.8`](https://redirect.github.com/actions/python-versions/releases/tag/3.12.8-12154062663):
3.12.8

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.12.7-11128208086...3.12.8-12154062663)

Python 3.12.8

###
[`v3.12.7`](https://redirect.github.com/actions/python-versions/releases/tag/3.12.7-11128208086):
3.12.7

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.12.6-10765725458...3.12.7-11128208086)

Python 3.12.7

###
[`v3.12.6`](https://redirect.github.com/actions/python-versions/releases/tag/3.12.6-10765725458):
3.12.6

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.12.5-10375840348...3.12.6-10765725458)

Python 3.12.6

###
[`v3.12.5`](https://redirect.github.com/actions/python-versions/releases/tag/3.12.5-10375840348):
3.12.5

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.12.4-9947065640...3.12.5-10375840348)

Python 3.12.5

###
[`v3.12.4`](https://redirect.github.com/actions/python-versions/releases/tag/3.12.4-9947065640):
3.12.4

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.12.3-11057844995...3.12.4-9947065640)

Python 3.12.4

###
[`v3.12.3`](https://redirect.github.com/actions/python-versions/releases/tag/3.12.3-11057844995):
3.12.3

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.12.2-11057786931...3.12.3-11057844995)

Python 3.12.3

###
[`v3.12.2`](https://redirect.github.com/actions/python-versions/releases/tag/3.12.2-11057786931):
3.12.2

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.12.1-11057762749...3.12.2-11057786931)

Python 3.12.2

###
[`v3.12.1`](https://redirect.github.com/actions/python-versions/releases/tag/3.12.1-11057762749):
3.12.1

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.12.0-11057302691...3.12.1-11057762749)

Python 3.12.1

###
[`v3.12.0`](https://redirect.github.com/actions/python-versions/releases/tag/3.12.0-11057302691):
3.12.0

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.11.14-18393181605...3.12.0-11057302691)

Python 3.12.0

###
[`v3.11.14`](https://redirect.github.com/actions/python-versions/releases/tag/3.11.14-18393181605):
3.11.14

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.11.13-15433298024...3.11.14-18393181605)

Python 3.11.14

###
[`v3.11.13`](https://redirect.github.com/actions/python-versions/releases/tag/3.11.13-15433298024):
3.11.13

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.11.12-14343939122...3.11.13-15433298024)

Python 3.11.13

###
[`v3.11.12`](https://redirect.github.com/actions/python-versions/releases/tag/3.11.12-14343939122):
3.11.12

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.11.11-12160100664...3.11.12-14343939122)

Python 3.11.12

###
[`v3.11.11`](https://redirect.github.com/actions/python-versions/releases/tag/3.11.11-12160100664):
3.11.11

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.11.10-10765870205...3.11.11-12160100664)

Python 3.11.11

###
[`v3.11.10`](https://redirect.github.com/actions/python-versions/releases/tag/3.11.10-10765870205):
3.11.10

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.11.9-9947079978...3.11.10-10765870205)

Python 3.11.10

###
[`v3.11.9`](https://redirect.github.com/actions/python-versions/releases/tag/3.11.9-9947079978):
3.11.9

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.11.8-11113201752...3.11.9-9947079978)

Python 3.11.9

###
[`v3.11.8`](https://redirect.github.com/actions/python-versions/releases/tag/3.11.8-11113201752):
3.11.8

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.11.7-11113197120...3.11.8-11113201752)

Python 3.11.8

###
[`v3.11.7`](https://redirect.github.com/actions/python-versions/releases/tag/3.11.7-11113197120):
3.11.7

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.11.6-11113179737...3.11.7-11113197120)

Python 3.11.7

###
[`v3.11.6`](https://redirect.github.com/actions/python-versions/releases/tag/3.11.6-11113179737):
3.11.6

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.11.5-11113174019...3.11.6-11113179737)

Python 3.11.6

###
[`v3.11.5`](https://redirect.github.com/actions/python-versions/releases/tag/3.11.5-11113174019):
3.11.5

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.11.4-11113170699...3.11.5-11113174019)

Python 3.11.5

###
[`v3.11.4`](https://redirect.github.com/actions/python-versions/releases/tag/3.11.4-11113170699):
3.11.4

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.11.3-11059198104...3.11.4-11113170699)

Python 3.11.4

###
[`v3.11.3`](https://redirect.github.com/actions/python-versions/releases/tag/3.11.3-11059198104):
3.11.3

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.11.2-11059137522...3.11.3-11059198104)

Python 3.11.3

###
[`v3.11.2`](https://redirect.github.com/actions/python-versions/releases/tag/3.11.2-11059137522):
3.11.2

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.11.1-11058799881...3.11.2-11059137522)

Python 3.11.2

###
[`v3.11.1`](https://redirect.github.com/actions/python-versions/releases/tag/3.11.1-11058799881):
3.11.1

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.11.0-11058707212...3.11.1-11058799881)

Python 3.11.1

###
[`v3.11.0`](https://redirect.github.com/actions/python-versions/releases/tag/3.11.0-11058707212):
3.11.0

[Compare
Source](https://redirect.github.com/actions/python-versions/compare/3.10.19-18393196481...3.11.0-11058707212)

Python 3.11.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

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

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/googleapis/python-datastore).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My44LjUiLCJ1cGRhdGVkSW5WZXIiOiI0My44LjUiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=-->

---------

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
@chalmerlowe chalmerlowe requested review from a team as code owners February 18, 2026 18:16
@snippet-bot
Copy link

snippet-bot bot commented Feb 18, 2026

Here is the summary of changes.

You are about to add 19 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label bot added samples Issues that are directly related to samples. api: datastore Issues related to the Datastore API. labels Feb 18, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @chalmerlowe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request integrates a comprehensive suite of Google Cloud Datastore samples and their supporting development environment. It significantly enhances the project's sample coverage by introducing new query capabilities, aggregation functions, and query profiling tools. The changes also establish a robust and modern testing framework using nox, ensuring better code quality and maintainability, while extending compatibility to recent Python versions and updating key dependencies.

Highlights

  • Code Migration: Migrated a significant set of Google Cloud Datastore samples and their associated development infrastructure from the googleapis/python-datastore repository into this project.
  • New Development and Testing Setup: Introduced nox for managing development workflows, including linting, code formatting with Black and Isort, and running tests across various Python versions. This includes dedicated noxfile.py and noxfile_config.py files for both the main snippets and the scheduled export sample.
  • Expanded Datastore Query Samples: Added new code snippets demonstrating advanced Datastore query operators such as IN, NOT_IN, and !=. Also included examples for using read_time in queries and get() operations for stale reads.
  • New Aggregation Query Samples: Implemented samples for various aggregation queries, including Count, Sum, and Avg aggregations, with examples for use within transactions, with limits, and with property filters.
  • Query Profiling (Explain/Analyze): Introduced new features and samples for query profiling, allowing users to explain and analyze both entity and aggregation queries to understand their execution plan and statistics.
  • Scheduled Datastore Exports Sample: Added a new sample demonstrating how to schedule Datastore exports using a Cloud Function triggered by Cloud Scheduler, complete with its own README.md, main.py implementation, and tests.
  • Python Version and Dependency Updates: Updated the supported Python versions to require 3.7+ and added support for Python 3.11, 3.12, and 3.14. All project dependencies, including google-cloud-datastore, pytest, and backoff, were updated to their latest versions.
Changelog
  • datastore/samples/snippets/noxfile.py
    • Added a new nox configuration file to define linting, formatting, and testing sessions for the snippets.
  • datastore/samples/snippets/noxfile_config.py
    • Added a new configuration override file for nox, allowing customization of test parameters.
  • datastore/samples/snippets/requirements-test.txt
    • Added a new file specifying testing dependencies with version constraints for different Python versions.
  • datastore/samples/snippets/requirements.txt
    • Added a new file specifying the core google-cloud-datastore dependency.
  • datastore/samples/snippets/schedule-export/README.md
    • Added documentation for the scheduled Datastore export sample.
  • datastore/samples/snippets/schedule-export/main.py
    • Added the Cloud Function implementation for triggering Datastore exports.
  • datastore/samples/snippets/schedule-export/noxfile.py
    • Added a nox configuration file specific to the scheduled export sample.
  • datastore/samples/snippets/schedule-export/noxfile_config.py
    • Added a nox configuration override file specific to the scheduled export sample.
  • datastore/samples/snippets/schedule-export/requirements-test.txt
    • Added testing dependencies for the scheduled export sample.
  • datastore/samples/snippets/schedule-export/requirements.txt
    • Added the core google-cloud-datastore dependency for the scheduled export sample.
  • datastore/samples/snippets/schedule-export/schedule_export_test.py
    • Added unit tests for the datastore_export Cloud Function.
  • datastore/samples/snippets/snippets.py
    • Added a new file containing various Datastore query, aggregation, and profiling code examples.
  • datastore/samples/snippets/snippets_test.py
    • Added tests for the Datastore query, aggregation, and profiling snippets, including index setup.
Activity
  • The pull request title indicates a migration of code from googleapis/python-datastore.
  • The description lists numerous commits, primarily focusing on dependency updates and the addition of new samples, suggesting a consolidation of recent development efforts.
  • New files were added across multiple directories, establishing a new structure for Datastore samples and their testing infrastructure.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request migrates a significant amount of code and samples for python-datastore. The changes are extensive, introducing many new files for snippets and tests. My review focuses on ensuring the new code is correct, maintainable, and follows best practices. I've identified several issues, including potential runtime errors in the noxfile.py and Cloud Function main.py, test-related logic that has leaked into user-facing sample code, and a broken main function in snippets.py. I've provided suggestions to fix these issues.

Comment on lines +201 to +218
concurrent_args = []
if os.path.exists("requirements.txt"):
if os.path.exists("constraints.txt"):
session.install("-r", "requirements.txt", "-c", "constraints.txt")
else:
session.install("-r", "requirements.txt")
with open("requirements.txt") as rfile:
packages = rfile.read()

if os.path.exists("requirements-test.txt"):
if os.path.exists("constraints-test.txt"):
session.install(
"-r", "requirements-test.txt", "-c", "constraints-test.txt"
)
else:
session.install("-r", "requirements-test.txt")
with open("requirements-test.txt") as rtfile:
packages += rtfile.read()
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The packages variable is used on line 218 but is only initialized if requirements.txt exists. If requirements.txt is not present but requirements-test.txt is, this will cause an UnboundLocalError. To prevent this, packages should be initialized to an empty string before the conditional blocks.

Suggested change
concurrent_args = []
if os.path.exists("requirements.txt"):
if os.path.exists("constraints.txt"):
session.install("-r", "requirements.txt", "-c", "constraints.txt")
else:
session.install("-r", "requirements.txt")
with open("requirements.txt") as rfile:
packages = rfile.read()
if os.path.exists("requirements-test.txt"):
if os.path.exists("constraints-test.txt"):
session.install(
"-r", "requirements-test.txt", "-c", "constraints-test.txt"
)
else:
session.install("-r", "requirements-test.txt")
with open("requirements-test.txt") as rtfile:
packages += rtfile.read()
concurrent_args = []
packages = ""
if os.path.exists("requirements.txt"):
if os.path.exists("constraints.txt"):
session.install("-r", "requirements.txt", "-c", "constraints.txt")
else:
session.install("-r", "requirements.txt")
with open("requirements.txt") as rfile:
packages = rfile.read()
if os.path.exists("requirements-test.txt"):
if os.path.exists("constraints-test.txt"):
session.install(
"-r", "requirements-test.txt", "-c", "constraints-test.txt"
)
else:
session.install("-r", "requirements-test.txt")
with open("requirements-test.txt") as rtfile:
packages += rtfile.read()

Comment on lines +187 to +188
tasks = [task for task in client.query(kind="Task").fetch()]
client.delete_multi(tasks) # ensure the database is empty before starting
Copy link
Contributor

Choose a reason for hiding this comment

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

high

These lines appear to be test setup logic to ensure the database is empty before the snippet runs. Sample code for users should not contain such setup or cleanup logic. This should be handled by the test code that calls the snippet.


from google.cloud import datastore_admin_v1

project_id = os.environ.get("GCP_PROJECT")
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Using os.environ.get("GCP_PROJECT") will result in project_id being None if the environment variable is not set, which will cause a failure later in the function. It's better to fail early with a clear error message if this required environment variable is missing. Accessing it directly with os.environ["GCP_PROJECT"] will raise a KeyError if it's not set, which is a more robust way to handle required environment variables.

Suggested change
project_id = os.environ.get("GCP_PROJECT")
project_id = os.environ["GCP_PROJECT"]

# Otherwise, for instance if triggered via the Cloud Console on a Cloud Function, the event is the data.
json_data = event

bucket = json_data["bucket"]
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Directly accessing json_data['bucket'] will raise a KeyError if 'bucket' is not in the payload, causing the function to fail with an unhandled exception. It's safer to use .get() and validate that the bucket is provided.

Comment on lines +490 to +497
if name in (
"main",
"_preamble",
"defaultdict",
"datetime",
"timezone",
"timedelta",
) or not callable(function):
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The loop over globals().items() will attempt to call imported items like pprint as if they were snippet functions, which will raise a TypeError. The list of names to exclude is incomplete and also contains defaultdict, which is not imported in this file.

Suggested change
if name in (
"main",
"_preamble",
"defaultdict",
"datetime",
"timezone",
"timedelta",
) or not callable(function):
if name in (
"main",
"_preamble",
"pprint",
"datetime",
"timezone",
"timedelta",
) or not callable(function):

Comment on lines +52 to +54
json_string = '{{ "bucket": "{bucket}", "kinds": "{kinds}", "namespaceIds": "{namespaceIds}" }}'.format(
bucket=bucket, kinds=kinds, namespaceIds=namespaceIds
)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Constructing JSON strings with string formatting can be error-prone and hard to read. Using json.dumps() is a safer and more idiomatic way to create JSON strings in Python. You'll need to add import json at the top of the file.

Suggested change
json_string = '{{ "bucket": "{bucket}", "kinds": "{kinds}", "namespaceIds": "{namespaceIds}" }}'.format(
bucket=bucket, kinds=kinds, namespaceIds=namespaceIds
)
json_string = json.dumps(
{"bucket": bucket, "kinds": kinds, "namespaceIds": namespaceIds}
)


# Call tested function
main.datastore_export(event, mock_context)
out, err = capsys.readouterr()
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The out and err variables are captured from capsys but are never used. If you don't intend to make assertions on the captured output, this line can be removed.

Comment on lines +188 to +200
) -> None:
# check for presence of tests
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob("**/test_*.py", recursive=True)
test_list.extend(glob.glob("**/tests", recursive=True))

if len(test_list) == 0:
print("No tests found, skipping directory.")
return

if TEST_CONFIG["pip_version_override"]:
pip_version = TEST_CONFIG["pip_version_override"]
session.install(f"pip=={pip_version}")
"""Runs py.test for a particular project."""
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The docstring for _session_tests is misplaced. It should be located immediately after the function signature on line 188 to follow standard Python conventions.

def test_datastore_export(capsys):
# Test an export without an entity filter
bucket = "gs://my-bucket"
json_string = '{{ "bucket": "{bucket}" }}'.format(bucket=bucket)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Constructing JSON strings with string formatting can be error-prone and hard to read. Using json.dumps() is a safer and more idiomatic way to create JSON strings in Python. You'll need to add import json at the top of the file.

Suggested change
json_string = '{{ "bucket": "{bucket}" }}'.format(bucket=bucket)
json_string = json.dumps({"bucket": bucket})

Comment on lines +188 to +200
) -> None:
# check for presence of tests
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob("**/test_*.py", recursive=True)
test_list.extend(glob.glob("**/tests", recursive=True))

if len(test_list) == 0:
print("No tests found, skipping directory.")
return

if TEST_CONFIG["pip_version_override"]:
pip_version = TEST_CONFIG["pip_version_override"]
session.install(f"pip=={pip_version}")
"""Runs py.test for a particular project."""
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The docstring for _session_tests is misplaced. It should be located immediately after the function signature on line 188 to follow standard Python conventions.

@chalmerlowe chalmerlowe changed the title migrate code from googleapis/python-datastore chore: migrate code from googleapis/python-datastore Feb 18, 2026
@chalmerlowe
Copy link
Contributor Author

@iennae

It looks like at least one of the tests is failing because we are performing an exact string match on the repr() of a list containing a dictionary. Since dictionary key order in string representations can be non-deterministic, this makes the assertion brittle even if the data itself is correct.

To fix the flakiness while maintaining clarity, we could consider one of the following approaches:

Option 1: Assert on the data, not the string (Recommended)

We can modify the sample to return the plan_summary object. This allows us to verify the data structure directly in the test. Python’s == operator for dictionaries is order-independent, which makes the test much more robust.

In the sample code:

    # ...
    plan_summary = iterator.explain_metrics.plan_summary
    print(f"Indexes used: {plan_summary.indexes_used}")
    return plan_summary # Return for testing purposes

In the test:

    plan_summary = snippets.explain_aggregation(client)
    expected_indexes = [{'properties': '(__name__ ASC)', 'query_scope': 'Collection group'}]
    assert plan_summary.indexes_used == expected_indexes

Option 2: Canonicalize the output using JSON

If we prefer to keep the assertion strictly against the printed output, we can use json.dumps with sort_keys=True in the sample. This ensures the keys always appear in the same order in stdout, regardless of how the dictionary was initialized.

In the sample code:

    import json
    # ...
    print(f"Indexes used: {json.dumps(plan_summary.indexes_used, sort_keys=True)}")

In the test:

    # Note: JSON uses double quotes
    assert 'Indexes used: [{"properties": "(__name__ ASC)", "query_scope": "Collection group"}]' in captured.out

What do we think? Option 1 feels a bit cleaner as it avoids adding a json import to a simple snippet, but Option 2 keeps the test focused entirely on the capsys output if that is our preferred pattern for snippets.

@chalmerlowe
Copy link
Contributor Author

chalmerlowe commented Feb 19, 2026

@iennae two other failing tests are not familiar to me:

  • In the 3.14 CI/CD check we get this error:

404 Project 'python-docs-samples-tests-314' does not exist.

I am not sure on the correct steps for resolving that.

  • In the 3.8 CI/CD check we get an error where nox just goes belly up. Not sure if you have seen that before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: datastore Issues related to the Datastore API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

Comments