Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: pytest-dev/pytest
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7.2.0
Choose a base ref
...
head repository: pytest-dev/pytest
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7.2.1
Choose a head ref

Commits on Oct 25, 2022

  1. Merge pull request #10412 from pytest-dev/release-7.2.0

    Prepare release 7.2.0
    RonnyPfannschmidt authored Oct 25, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ac4e3cc View commit details
  2. [7.2.x] upgrade pygments-pytest for 7.2.x coloring

    asottile authored and pytestbot committed Oct 25, 2022
    Copy the full SHA
    5c6a9a6 View commit details
  3. [7.2.x] Add the PyPI classifier for Python 3.11

    bryant1410 authored and pytestbot committed Oct 25, 2022
    Copy the full SHA
    1f08cd7 View commit details
  4. [7.2.x] Edit changelog for 7.2.0 (#10429)

    Co-authored-by: Florian Bruhin <me@the-compiler.org>
    github-actions[bot] and The-Compiler authored Oct 25, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    651c7bf View commit details
  5. Merge pull request #10417 from nicoddemus/publish-action-pin

    Use specific tag in the gh-action-pypi-publish action
    nicoddemus committed Oct 25, 2022
    Copy the full SHA
    23bbd5a View commit details
  6. Merge pull request #10432 from nicoddemus/backport-10417

    [2.7.x] Use specific tag in the gh-action-pypi-publish action
    nicoddemus authored Oct 25, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    eff2e2d View commit details
  7. Merge pull request #10430 from pytest-dev/backport-10425-to-7.2.x

    [7.2.x] upgrade pygments-pytest for 7.2.x coloring
    nicoddemus authored Oct 25, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6a4a0f4 View commit details
  8. Merge pull request #10431 from pytest-dev/backport-10426-to-7.2.x

    [7.2.x] Add the PyPI classifier for Python 3.11
    nicoddemus authored Oct 25, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8606feb View commit details

Commits on Oct 31, 2022

  1. [7.2.x] Fix 'importlib.abc.TraversableResources' deprecation warning …

    …in Python 3.12 (#10453)
    
    Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
    github-actions[bot] and hugovk authored Oct 31, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6a5076d View commit details

Commits on Nov 4, 2022

  1. [7.2.x] Remove done trainings (#10472)

    Co-authored-by: Florian Bruhin <me@the-compiler.org>
    github-actions[bot] and The-Compiler authored Nov 4, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b2271af View commit details

Commits on Nov 9, 2022

  1. [7.2.x] Fix test_raising_repr test

    nicoddemus authored and pytestbot committed Nov 9, 2022
    Copy the full SHA
    dbd4c5f View commit details
  2. Merge pull request #10489 from pytest-dev/backport-10488-to-7.2.x

    [7.2.x] Fix test_raising_repr test
    nicoddemus authored Nov 9, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    47d6adf View commit details

Commits on Nov 18, 2022

  1. [7.2.x] issue-10457/show test name when skipping from fixture

    DanielVZ96 authored and pytestbot committed Nov 18, 2022
    Copy the full SHA
    f5d2edc View commit details
  2. Merge pull request #10513 from pytest-dev/backport-10482-to-7.2.x

    [7.2.x] issue-10457/show test name when skipping from fixture
    nicoddemus authored Nov 18, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3c2f90b View commit details

Commits on Nov 23, 2022

  1. [7.2.x] Issue #10506

    PrerakPatelCS authored and pytestbot committed Nov 23, 2022
    Copy the full SHA
    c3b0080 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7d35baa View commit details

Commits on Dec 14, 2022

  1. Fix tox 4.0 support and docs

    Also includes pre-commit autoupdate
    nicoddemus committed Dec 14, 2022
    Copy the full SHA
    f198974 View commit details
  2. Merge pull request #10586 from nicoddemus/backport-10578

    [7.2.x] Fix tox 4.0 support and docs
    nicoddemus authored Dec 14, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c16315f View commit details

Commits on Jan 5, 2023

  1. [7.2.x] Fix tests pygments 2.14.0

    nicoddemus authored and pytestbot committed Jan 5, 2023
    Copy the full SHA
    405fd15 View commit details
  2. Merge pull request #10637 from pytest-dev/backport-10632-to-7.2.x

    [7.2.x] Fix tests pygments 2.14.0
    nicoddemus authored Jan 5, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    08d0dd0 View commit details

Commits on Jan 6, 2023

  1. [7.2.x] Mitigate directory creation race condition

    Kadino authored and pytestbot committed Jan 6, 2023
    Copy the full SHA
    a6f85a0 View commit details
  2. Merge pull request #10638 from pytest-dev/backport-10607-to-7.2.x

    [7.2.x] Mitigate directory creation race condition
    nicoddemus authored Jan 6, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    211d08e View commit details

Commits on Jan 13, 2023

  1. [7.2.x] Dont update cache from xdist worker

    s-padmanaban authored and pytestbot committed Jan 13, 2023
    Copy the full SHA
    f22fbbf View commit details
  2. [7.2.x] Fix regen tox environment

    nicoddemus authored and pytestbot committed Jan 13, 2023
    Copy the full SHA
    e8055c1 View commit details
  3. Merge pull request #10657 from pytest-dev/backport-10640-to-7.2.x

    [7.2.x] Fix regen tox environment
    nicoddemus authored Jan 13, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9440702 View commit details
  4. Merge pull request #10656 from pytest-dev/backport-10641-to-7.2.x

    [7.2.x] Dont update cache from xdist worker
    nicoddemus authored Jan 13, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    cb07711 View commit details
  5. Prepare release version 7.2.1

    pytestbot committed Jan 13, 2023
    Copy the full SHA
    1ae778f View commit details
3 changes: 1 addition & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -43,9 +43,8 @@ jobs:
python -m build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_token }}

- name: Publish GitHub release notes
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ default_language_version:
python: "3.10"
repos:
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 22.12.0
hooks:
- id: black
args: [--safe, --quiet]
@@ -44,15 +44,15 @@ repos:
- id: reorder-python-imports
args: ['--application-directories=.:src', --py37-plus]
- repo: https://github.com/asottile/pyupgrade
rev: v3.1.0
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.1.0
hooks:
- id: setup-cfg-fmt
args: ["--max-py-version=3.10", "--include-version-classifiers"]
args: ["--max-py-version=3.11", "--include-version-classifiers"]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
9 changes: 6 additions & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -2,9 +2,12 @@ version: 2

python:
install:
- requirements: doc/en/requirements.txt
- method: pip
path: .
# Install pytest first, then doc/en/requirements.txt.
# This order is important to honor any pins in doc/en/requirements.txt
# when the pinned library is also a dependency of pytest.
- method: pip
path: .
- requirements: doc/en/requirements.txt

build:
os: ubuntu-20.04
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -88,6 +88,7 @@ Daniel Grana
Daniel Hahler
Daniel Nuri
Daniel Sánchez Castelló
Daniel Valenzuela Zenteno
Daniel Wandschneider
Daniele Procida
Danielle Jenkins
@@ -310,6 +311,7 @@ Samuel Searles-Bryant
Samuele Pedroni
Sanket Duthade
Sankt Petersbug
Saravanan Padmanaban
Segev Finer
Serhii Mozghovyi
Seth Junot
1 change: 1 addition & 0 deletions doc/en/announce/index.rst
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ Release announcements
:maxdepth: 2


release-7.2.1
release-7.2.0
release-7.1.3
release-7.1.2
25 changes: 25 additions & 0 deletions doc/en/announce/release-7.2.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
pytest-7.2.1
=======================================

pytest 7.2.1 has just been released to PyPI.

This is a bug-fix release, being a drop-in replacement. To upgrade::

pip install --upgrade pytest

The full changelog is available at https://docs.pytest.org/en/stable/changelog.html.

Thanks to all of the contributors to this release:

* Anthony Sottile
* Bruno Oliveira
* Daniel Valenzuela
* Kadino
* Prerak Patel
* Ronny Pfannschmidt
* Santiago Castro
* s-padmanaban


Happy testing,
The pytest Development Team
2 changes: 1 addition & 1 deletion doc/en/builtin.rst
Original file line number Diff line number Diff line change
@@ -119,7 +119,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
For more details: :ref:`doctest_namespace`.
pytestconfig [session scope] -- .../_pytest/fixtures.py:1351
pytestconfig [session scope] -- .../_pytest/fixtures.py:1356
Session-scoped fixture that returns the session's :class:`pytest.Config`
object.
36 changes: 26 additions & 10 deletions doc/en/changelog.rst
Original file line number Diff line number Diff line change
@@ -28,6 +28,27 @@ with advance notice in the **Deprecations** section of releases.

.. towncrier release notes start
pytest 7.2.1 (2023-01-13)
=========================

Bug Fixes
---------

- `#10452 <https://github.com/pytest-dev/pytest/issues/10452>`_: Fix 'importlib.abc.TraversableResources' deprecation warning in Python 3.12.


- `#10457 <https://github.com/pytest-dev/pytest/issues/10457>`_: If a test is skipped from inside a fixture, the test summary now shows the test location instead of the fixture location.


- `#10506 <https://github.com/pytest-dev/pytest/issues/10506>`_: Fix bug where sometimes pytest would use the file system root directory as :ref:`rootdir <rootdir>` on Windows.


- `#10607 <https://github.com/pytest-dev/pytest/issues/10607>`_: Fix a race condition when creating junitxml reports, which could occur when multiple instances of pytest execute in parallel.


- `#10641 <https://github.com/pytest-dev/pytest/issues/10641>`_: Fix a race condition when creating or updating the stepwise plugin's cache, which could occur when multiple xdist worker nodes try to simultaneously update the stepwise plugin's cache.


pytest 7.2.0 (2022-10-23)
=========================

@@ -57,6 +78,7 @@ Deprecations

.. _`with-setup-nose`: https://nose.readthedocs.io/en/latest/testing_tools.html?highlight=with_setup#nose.tools.with_setup

- `#7337 <https://github.com/pytest-dev/pytest/issues/7337>`_: A deprecation warning is now emitted if a test function returns something other than `None`. This prevents a common mistake among beginners that expect that returning a `bool` (for example `return foo(a, b) == result`) would cause a test to pass or fail, instead of using `assert`. The plan is to make returning non-`None` from tests an error in the future.


Features
@@ -79,10 +101,7 @@ Improvements
- `#10381 <https://github.com/pytest-dev/pytest/issues/10381>`_: The ``--no-showlocals`` flag has been added. This can be passed directly to tests to override ``--showlocals`` declared through ``addopts``.


- `#3426 <https://github.com/pytest-dev/pytest/issues/3426>`_: Assertion failures with strings in NFC and NFD forms that normalize to the same string now have a dedicated error message detailing the issue, and their utf-8 representation is expresed instead.


- `#7337 <https://github.com/pytest-dev/pytest/issues/7337>`_: A warning is now emitted if a test function returns something other than `None`. This prevents a common mistake among beginners that expect that returning a `bool` (for example `return foo(a, b) == result`) would cause a test to pass or fail, instead of using `assert`.
- `#3426 <https://github.com/pytest-dev/pytest/issues/3426>`_: Assertion failures with strings in NFC and NFD forms that normalize to the same string now have a dedicated error message detailing the issue, and their utf-8 representation is expressed instead.


- `#8508 <https://github.com/pytest-dev/pytest/issues/8508>`_: Introduce multiline display for warning matching via :py:func:`pytest.warns` and
@@ -95,7 +114,7 @@ Improvements

- `#9741 <https://github.com/pytest-dev/pytest/issues/9741>`_: On Python 3.11, use the standard library's :mod:`tomllib` to parse TOML.

:mod:`tomli`` is no longer a dependency on Python 3.11.
:mod:`tomli` is no longer a dependency on Python 3.11.


- `#9742 <https://github.com/pytest-dev/pytest/issues/9742>`_: Display assertion message without escaped newline characters with ``-vv``.
@@ -110,7 +129,7 @@ Improvements
- `#9883 <https://github.com/pytest-dev/pytest/issues/9883>`_: Normalize the help description of all command-line options.


- `#9920 <https://github.com/pytest-dev/pytest/issues/9920>`_: Display full crash messages in ``short test summary info``, when runng in a CI environment.
- `#9920 <https://github.com/pytest-dev/pytest/issues/9920>`_: Display full crash messages in ``short test summary info``, when running in a CI environment.


- `#9987 <https://github.com/pytest-dev/pytest/issues/9987>`_: Added support for hidden configuration file by allowing ``.pytest.ini`` as an alternative to ``pytest.ini``.
@@ -156,9 +175,6 @@ Improved Documentation
Trivial/Internal Changes
------------------------

- `#10196 <https://github.com/pytest-dev/pytest/issues/10196>`_: :class:`~pytest.PytestReturnNotNoneWarning` is now a subclass of :class:`~pytest.PytestRemovedIn8Warning`: the plan is to make returning non-``None`` from tests an error in the future.


- `#10313 <https://github.com/pytest-dev/pytest/issues/10313>`_: Made ``_pytest.doctest.DoctestItem`` export ``pytest.DoctestItem`` for
type check and runtime purposes. Made `_pytest.doctest` use internal APIs
to avoid circular imports.
@@ -173,7 +189,7 @@ Trivial/Internal Changes
- `#9984 <https://github.com/pytest-dev/pytest/issues/9984>`_: Improve the error message when we attempt to access a fixture that has been
torn down.
Add an additional sentence to the docstring explaining when it's not a good
idea to call getfixturevalue.
idea to call ``getfixturevalue``.


pytest 7.1.3 (2022-08-31)
8 changes: 4 additions & 4 deletions doc/en/example/parametrize.rst
Original file line number Diff line number Diff line change
@@ -504,9 +504,9 @@ Running it results in some skips if we don't have all the python interpreters in
. $ pytest -rs -q multipython.py
sssssssssssssssssssssssssss [100%]
========================= short test summary info ==========================
SKIPPED [9] multipython.py:29: 'python3.5' not found
SKIPPED [9] multipython.py:29: 'python3.6' not found
SKIPPED [9] multipython.py:29: 'python3.7' not found
SKIPPED [9] multipython.py:69: 'python3.5' not found
SKIPPED [9] multipython.py:69: 'python3.6' not found
SKIPPED [9] multipython.py:69: 'python3.7' not found
27 skipped in 0.12s
Indirect parametrization of optional implementations/imports
@@ -574,7 +574,7 @@ If you run this with reporting for skips enabled:
test_module.py .s [100%]
========================= short test summary info ==========================
SKIPPED [1] conftest.py:12: could not import 'opt2': No module named 'opt2'
SKIPPED [1] test_module.py:3: could not import 'opt2': No module named 'opt2'
======================= 1 passed, 1 skipped in 0.12s =======================
You'll see that we don't have an ``opt2`` module and thus the second test run
4 changes: 2 additions & 2 deletions doc/en/explanation/goodpractices.rst
Original file line number Diff line number Diff line change
@@ -270,8 +270,8 @@ tox

Once you are done with your work and want to make sure that your actual
package passes all tests you may want to look into :doc:`tox <tox:index>`, the
virtualenv test automation tool and its :doc:`pytest support <tox:example/pytest>`.
tox helps you to setup virtualenv environments with pre-defined
virtualenv test automation tool.
``tox`` helps you to setup virtualenv environments with pre-defined
dependencies and then executing a pre-configured test command with
options. It will run tests against the installed package and not
against your source code checkout, helping to detect packaging
2 changes: 1 addition & 1 deletion doc/en/getting-started.rst
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ Install ``pytest``
.. code-block:: bash
$ pytest --version
pytest 7.2.0
pytest 7.2.1
.. _`simpletest`:

1 change: 0 additions & 1 deletion doc/en/index.rst
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@

.. sidebar:: Next Open Trainings

- Professionelles Testen für Python mit pytest, part of `enterPy <https://www.enterpy.de/>`__ (German), `October 28th <https://www.enterpy.de/veranstaltung-15409-se-0-professionelles-testen-fuer-python-mit-pytest.html>`__ (sold out) and `November 4th <https://www.enterpy.de/veranstaltung-15557-se-0-professionelles-testen-fuer-python-mit-pytest-zusatztermin.html>`__, online
- `Professional Testing with Python <https://python-academy.com/courses/python_course_testing.html>`_, via `Python Academy <https://www.python-academy.com/>`_, March 7th to 9th 2023 (3 day in-depth training), Remote and Leipzig, Germany

Also see :doc:`previous talks and blogposts <talks>`.
6 changes: 5 additions & 1 deletion doc/en/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
pallets-sphinx-themes
pluggy>=1.0
pygments-pytest>=2.2.0
pygments-pytest>=2.3.0
sphinx-removed-in>=0.2.0
sphinx>=5,<6
sphinxcontrib-trio
sphinxcontrib-svg2pdfconverter
# Pin packaging because it no longer handles 'latest' version, which
# is the version that is assigned to the docs.
# See https://github.com/pytest-dev/pytest/pull/10578#issuecomment-1348249045.
packaging <22
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development :: Libraries
Topic :: Software Development :: Testing
Topic :: Utilities
7 changes: 6 additions & 1 deletion src/_pytest/assertion/rewrite.py
Original file line number Diff line number Diff line change
@@ -275,7 +275,12 @@ def get_data(self, pathname: Union[str, bytes]) -> bytes:

if sys.version_info >= (3, 10):

def get_resource_reader(self, name: str) -> importlib.abc.TraversableResources: # type: ignore
if sys.version_info >= (3, 12):
from importlib.resources.abc import TraversableResources
else:
from importlib.abc import TraversableResources

def get_resource_reader(self, name: str) -> TraversableResources: # type: ignore
if sys.version_info < (3, 11):
from importlib.readers import FileReader
else:
11 changes: 9 additions & 2 deletions src/_pytest/config/findpaths.py
Original file line number Diff line number Diff line change
@@ -203,8 +203,7 @@ def determine_setup(
else:
cwd = Path.cwd()
rootdir = get_common_ancestor([cwd, ancestor])
is_fs_root = os.path.splitdrive(str(rootdir))[1] == "/"
if is_fs_root:
if is_fs_root(rootdir):
rootdir = ancestor
if rootdir_cmd_arg:
rootdir = absolutepath(os.path.expandvars(rootdir_cmd_arg))
@@ -216,3 +215,11 @@ def determine_setup(
)
assert rootdir is not None
return rootdir, inipath, inicfg or {}


def is_fs_root(p: Path) -> bool:
r"""
Return True if the given path is pointing to the root of the
file system ("/" on Unix and "C:\\" on Windows for example).
"""
return os.path.splitdrive(str(p))[1] == os.sep
5 changes: 5 additions & 0 deletions src/_pytest/fixtures.py
Original file line number Diff line number Diff line change
@@ -58,6 +58,7 @@
from _pytest.mark import ParameterSet
from _pytest.mark.structures import MarkDecorator
from _pytest.outcomes import fail
from _pytest.outcomes import skip
from _pytest.outcomes import TEST_OUTCOME
from _pytest.pathlib import absolutepath
from _pytest.pathlib import bestrelpath
@@ -1129,6 +1130,10 @@ def pytest_fixture_setup(
except TEST_OUTCOME:
exc_info = sys.exc_info()
assert exc_info[0] is not None
if isinstance(
exc_info[1], skip.Exception
) and not fixturefunc.__name__.startswith("xunit_setup"):
exc_info[1]._use_item_location = True # type: ignore[attr-defined]
fixturedef.cached_result = (None, my_cache_key, exc_info)
raise
fixturedef.cached_result = (result, my_cache_key, None)
4 changes: 2 additions & 2 deletions src/_pytest/junitxml.py
Original file line number Diff line number Diff line change
@@ -645,8 +645,8 @@ def pytest_sessionstart(self) -> None:

def pytest_sessionfinish(self) -> None:
dirname = os.path.dirname(os.path.abspath(self.logfile))
if not os.path.isdir(dirname):
os.makedirs(dirname)
# exist_ok avoids filesystem race conditions between checking path existence and requesting creation
os.makedirs(dirname, exist_ok=True)

with open(self.logfile, "w", encoding="utf-8") as logfile:
suite_stop_time = timing.time()
8 changes: 8 additions & 0 deletions src/_pytest/stepwise.py
Original file line number Diff line number Diff line change
@@ -48,6 +48,10 @@ def pytest_configure(config: Config) -> None:
def pytest_sessionfinish(session: Session) -> None:
if not session.config.getoption("stepwise"):
assert session.config.cache is not None
if hasattr(session.config, "workerinput"):
# Do not update cache if this process is a xdist worker to prevent
# race conditions (#10641).
return
# Clear the list of failing tests if the plugin is not active.
session.config.cache.set(STEPWISE_CACHE_DIR, [])

@@ -119,4 +123,8 @@ def pytest_report_collectionfinish(self) -> Optional[str]:
return None

def pytest_sessionfinish(self) -> None:
if hasattr(self.config, "workerinput"):
# Do not update cache if this process is a xdist worker to prevent
# race conditions (#10641).
return
self.cache.set(STEPWISE_CACHE_DIR, self.lastfailed)
1 change: 1 addition & 0 deletions testing/conftest.py
Original file line number Diff line number Diff line change
@@ -157,6 +157,7 @@ class ColorMapping:
"number": "\x1b[94m",
"str": "\x1b[33m",
"print": "\x1b[96m",
"endline": "\x1b[90m\x1b[39;49;00m",
}
RE_COLORS = {k: re.escape(v) for k, v in COLORS.items()}

2 changes: 1 addition & 1 deletion testing/io/test_terminalwriter.py
Original file line number Diff line number Diff line change
@@ -254,7 +254,7 @@ def test_combining(self) -> None:
pytest.param(
True,
True,
"{kw}assert{hl-reset} {number}0{hl-reset}\n",
"{kw}assert{hl-reset} {number}0{hl-reset}{endline}\n",
id="with markup and code_highlight",
),
pytest.param(
10 changes: 1 addition & 9 deletions testing/test_assertion.py
Original file line number Diff line number Diff line change
@@ -1664,15 +1664,7 @@ def test_raising_repr():
"""
)
result = pytester.runpytest()
if sys.version_info >= (3, 11):
# python 3.11 has native support for un-str-able exceptions
result.stdout.fnmatch_lines(
["E AssertionError: <exception str() failed>"]
)
else:
result.stdout.fnmatch_lines(
["E AssertionError: <unprintable AssertionError object>"]
)
result.stdout.fnmatch_lines(["E AssertionError: <exception str() failed>"])


def test_issue_1944(pytester: Pytester) -> None:
Loading