Skip to content

Commit

Permalink
Merge branch 'main' into fix-implicit-str-concat-and-discovered-bug-d…
Browse files Browse the repository at this point in the history
…ue-to-it
  • Loading branch information
Pierre-Sassoulas authored Oct 23, 2024
2 parents de40249 + 26215b8 commit 80aa8f2
Show file tree
Hide file tree
Showing 20 changed files with 267 additions and 165 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ jobs:
- name: "ubuntu-py313"
python: "3.13-dev"
os: ubuntu-latest
tox_env: "py313"
tox_env: "py313-pexpect"
use_coverage: true
- name: "ubuntu-pypy3"
python: "pypy-3.9"
Expand Down
6 changes: 2 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ repos:
hooks:
- id: mypy
files: ^(src/|testing/|scripts/)
args: []
language_version: "3.8"
additional_dependencies:
- iniconfig>=1.1.0
- attrs>=19.2.0
Expand All @@ -46,13 +44,13 @@ repos:
# on <3.11
- exceptiongroup>=1.0.0rc8
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "2.2.4"
rev: "2.3.1"
hooks:
- id: pyproject-fmt
# https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version
additional_dependencies: ["tox>=4.9"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
rev: v3.18.0
hooks:
- id: pyupgrade
stages: [manual]
Expand Down
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ Dave Hunt
David Díaz-Barquero
David Mohr
David Paul Röthlisberger
David Peled
David Szotten
David Vierra
Daw-Ran Liou
Expand Down Expand Up @@ -408,6 +409,7 @@ Sviatoslav Sydorenko
Sylvain Marié
Tadek Teleżyński
Takafumi Arakaki
Takumi Otani
Taneli Hukkinen
Tanvi Mehta
Tanya Agarwal
Expand Down
1 change: 1 addition & 0 deletions changelog/10558.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix ambiguous docstring of :func:`pytest.Config.getoption`.
1 change: 1 addition & 0 deletions changelog/12497.contrib.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed two failing pdb-related tests on Python 3.13.
1 change: 1 addition & 0 deletions changelog/12866.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improved cross-references concerning the :fixture:`recwarn` fixture.
1 change: 1 addition & 0 deletions changelog/9037.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Honor :confval:`disable_test_id_escaping_and_forfeit_all_rights_to_community_support` when escaping ids in parametrized tests.
3 changes: 1 addition & 2 deletions doc/en/builtin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
recwarn -- .../_pytest/recwarn.py:35
Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.
See https://docs.pytest.org/en/latest/how-to/capture-warnings.html for information
on warning categories.
See :ref:`warnings` for information on warning categories.
tmp_path_factory [session scope] -- .../_pytest/tmpdir.py:242
Return a :class:`pytest.TempPathFactory` instance for the test session.
Expand Down
17 changes: 8 additions & 9 deletions doc/en/how-to/capture-warnings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ user code and third-party libraries, as recommended by :pep:`565`.
This helps users keep their code modern and avoid breakages when deprecated warnings are effectively removed.

However, in the specific case where users capture any type of warnings in their test, either with
:func:`pytest.warns`, :func:`pytest.deprecated_call` or using the :ref:`recwarn <recwarn>` fixture,
:func:`pytest.warns`, :func:`pytest.deprecated_call` or using the :fixture:`recwarn` fixture,
no warning will be displayed at all.

Sometimes it is useful to hide some specific deprecation warnings that happen in code that you have no control over
Expand Down Expand Up @@ -332,10 +332,10 @@ additional information:
assert record[0].message.args[0] == "another warning"
Alternatively, you can examine raised warnings in detail using the
:ref:`recwarn <recwarn>` fixture (see below).
:fixture:`recwarn` fixture (see :ref:`below <recwarn>`).


The :ref:`recwarn <recwarn>` fixture automatically ensures to reset the warnings
The :fixture:`recwarn` fixture automatically ensures to reset the warnings
filter at the end of the test, so no global state is leaked.

.. _`recording warnings`:
Expand All @@ -345,8 +345,8 @@ filter at the end of the test, so no global state is leaked.
Recording warnings
------------------

You can record raised warnings either using :func:`pytest.warns` or with
the ``recwarn`` fixture.
You can record raised warnings either using the :func:`pytest.warns` context manager or with
the :fixture:`recwarn` fixture.

To record with :func:`pytest.warns` without asserting anything about the warnings,
pass no arguments as the expected warning type and it will default to a generic Warning:
Expand All @@ -361,7 +361,7 @@ pass no arguments as the expected warning type and it will default to a generic
assert str(record[0].message) == "user"
assert str(record[1].message) == "runtime"
The ``recwarn`` fixture will record warnings for the whole function:
The :fixture:`recwarn` fixture will record warnings for the whole function:

.. code-block:: python
Expand All @@ -377,12 +377,11 @@ The ``recwarn`` fixture will record warnings for the whole function:
assert w.filename
assert w.lineno
Both ``recwarn`` and :func:`pytest.warns` return the same interface for recorded
warnings: a WarningsRecorder instance. To view the recorded warnings, you can
Both the :fixture:`recwarn` fixture and the :func:`pytest.warns` context manager return the same interface for recorded
warnings: a :class:`~_pytest.recwarn.WarningsRecorder` instance. To view the recorded warnings, you can
iterate over this instance, call ``len`` on it to get the number of recorded
warnings, or index into it to get a particular recorded warning.

Full API: :class:`~_pytest.recwarn.WarningsRecorder`.

.. _`warns use cases`:

Expand Down
Loading

0 comments on commit 80aa8f2

Please sign in to comment.