Skip to content

Commit

Permalink
opt into strict mode by default (#380)
Browse files Browse the repository at this point in the history
* opt into strict mode by default

* docs: Update CHANGELOG.rst

Clarify that no code changes were necessary for Python 3.11 support.

Co-authored-by: Thomas Grainger <tagrain@gmail.com>

Co-authored-by: Michael Seifert <m.seifert@digitalernachschub.de>
  • Loading branch information
graingert and seifertm committed Jul 12, 2022
1 parent 25c54a5 commit 07beb80
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Expand Up @@ -4,8 +4,9 @@ Changelog

UNRELEASED
=================
- BREAKING: The default ``asyncio_mode`` is now *strict*. `#293 <https://github.com/pytest-dev/pytest-asyncio/issues/293>`_
- Removes `setup.py` since all relevant configuration is present `setup.cfg`. Users requiring an editable installation of pytest-asyncio need to use pip v21.1 or newer. `#283 <https://github.com/pytest-dev/pytest-asyncio/issues/283>`_
- Add support for Python 3.11.
- Declare support for Python 3.11.

0.18.3 (22-03-25)
=================
Expand Down
11 changes: 6 additions & 5 deletions README.rst
Expand Up @@ -58,7 +58,7 @@ Modes
-----

Starting from ``pytest-asyncio>=0.17``, three modes are provided: *auto*, *strict* and
*legacy* (default).
*legacy*. Starting from ``pytest-asyncio>=0.19`` the *strict* mode is the default.

The mode can be set by ``asyncio_mode`` configuration option in `configuration file
<https://docs.pytest.org/en/latest/reference/customize.html>`_:
Expand Down Expand Up @@ -104,18 +104,19 @@ pytest plugin can handle them.
Please use this mode if multiple async frameworks should be combined in the same test
suite.

This mode is used by default for the sake of project inter-compatibility.


Legacy mode
~~~~~~~~~~~

This mode follows rules used by ``pytest-asyncio<0.17``: tests are not auto-marked but
fixtures are.

This mode is used by default for the sake of backward compatibility, deprecation
warnings are emitted with suggestion to either switching to ``auto`` mode or using
``strict`` mode with ``@pytest_asyncio.fixture`` decorators.
Deprecation warnings are emitted with suggestion to either switching to ``auto`` mode
or using ``strict`` mode with ``@pytest_asyncio.fixture`` decorators.

In future, the default will be changed.
The default was changed to ``strict`` in ``pytest-asyncio>=0.19``.


Fixtures
Expand Down
2 changes: 1 addition & 1 deletion pytest_asyncio/plugin.py
Expand Up @@ -95,7 +95,7 @@ def pytest_addoption(parser: Parser, pluginmanager: PytestPluginManager) -> None
parser.addini(
"asyncio_mode",
help="default value for --asyncio-mode",
default="legacy",
default="strict",
)


Expand Down

0 comments on commit 07beb80

Please sign in to comment.