Skip to content

Commit e48515b

Browse files
committed
Merge branch 'main' into clarify-raises-match-error
2 parents 0326426 + 3daf6bf commit e48515b

File tree

10 files changed

+485
-268
lines changed

10 files changed

+485
-268
lines changed

README.rst

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

8181

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

8484

8585
Features

changelog/13537.bugfix.rst

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

changelog/13823.feature.rst

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
Added a :confval:`strict` configuration option to enable all strictness-related options.
22

3-
When set to ``True``, the :confval:`strict` option currently enables :confval:`strict_config`,
4-
:confval:`strict_markers`, :confval:`strict_xfail`, and :confval:`strict_parametrization_ids`.
3+
When set to ``true``, the :confval:`strict` option currently enables
4+
5+
* :confval:`strict_config`
6+
* :confval:`strict_markers`
7+
* :confval:`strict_parametrization_ids`
8+
* :confval:`strict_xfail`
59

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

8-
If new strictness options are added in the future, they will also be automatically enabled by :confval:`strict`.
9-
Therefore, we only recommend setting ``strict=True`` if you're using a locked version of pytest,
12+
The previously-deprecated ``--strict`` command-line flag now enables strict mode.
13+
14+
If pytest adds new strictness options in the future, they will also be enabled in strict mode.
15+
Therefore, you should only enable strict mode if you use a pinned/locked version of pytest,
1016
or if you want to proactively adopt new strictness options as they are added.
17+
18+
See :ref:`strict mode` for more details.

doc/en/explanation/goodpractices.rst

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,3 +329,75 @@ A list of the lints detected by flake8-pytest-style can be found on its `PyPI pa
329329
.. note::
330330

331331
flake8-pytest-style is not an official pytest project. Some of the rules enforce certain style choices, such as using `@pytest.fixture()` over `@pytest.fixture`, but you can configure the plugin to fit your preferred style.
332+
333+
.. _`strict mode`:
334+
335+
Using pytest's strict mode
336+
--------------------------
337+
338+
.. versionadded:: 9.0
339+
340+
Pytest contains a set of configuration options that make it more strict.
341+
The options are off by default for compatibility or other reasons,
342+
but you should enable them if you can.
343+
344+
You can enable all of the strictness options at once by setting the :confval:`strict` configuration option:
345+
346+
.. tab:: toml
347+
348+
.. code-block:: toml
349+
350+
[pytest]
351+
strict = true
352+
353+
.. tab:: ini
354+
355+
.. code-block:: ini
356+
357+
[pytest]
358+
strict = true
359+
360+
See the :confval:`strict` documentation for the options it enables and their effect.
361+
362+
If pytest adds new strictness options in the future, they will also be enabled in strict mode.
363+
Therefore, you should only enable strict mode if you use a pinned/locked version of pytest,
364+
or if you want to proactively adopt new strictness options as they are added.
365+
If you don't want to automatically pick up new options, you can enable options individually::
366+
367+
.. tab:: toml
368+
369+
.. code-block:: toml
370+
371+
[pytest]
372+
strict_config = true
373+
strict_markers = true
374+
strict_parametrization_ids = true
375+
strict_xfail = true
376+
377+
.. tab:: ini
378+
379+
.. code-block:: ini
380+
381+
[pytest]
382+
strict_config = true
383+
strict_markers = true
384+
strict_parametrization_ids = true
385+
strict_xfail = true
386+
387+
If you want to use strict mode but having trouble with a specific option, you can turn it off individually::
388+
389+
.. tab:: toml
390+
391+
.. code-block:: toml
392+
393+
[pytest]
394+
strict = true
395+
strict_parametrization_ids = false
396+
397+
.. tab:: ini
398+
399+
.. code-block:: ini
400+
401+
[pytest]
402+
strict = true
403+
strict_parametrization_ids = false

0 commit comments

Comments
 (0)