Skip to content

Commit

Permalink
feat: Add deprecation warning for pytest < 7. (#420)
Browse files Browse the repository at this point in the history
The last v6 release of pytest was v6.2.5 on 2021-08-29. People have had more than a year to upgrade to pytest 7. It is time to sunset support for pytest 6.

Signed-off-by: Michael Seifert <[email protected]>
  • Loading branch information
seifertm authored Oct 11, 2022
1 parent cab20f4 commit d45ab21
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Changelog
UNRELEASED
=================
- BREAKING: Removed *legacy* mode. If you're upgrading from v0.19 and you haven't configured ``asyncio_mode = legacy``, you can upgrade without taking any additional action. If you're upgrading from an earlier version or you have explicitly enabled *legacy* mode, you need to switch to *auto* or *strict* mode before upgrading to this version.
- Deprecate use of pytest v6.
- Fixed an issue which prevented fixture setup from being cached. `#404 <https://github.com/pytest-dev/pytest-asyncio/pull/404>`_

0.19.0 (22-07-13)
Expand Down
9 changes: 9 additions & 0 deletions pytest_asyncio/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import inspect
import socket
import sys
import warnings
from typing import (
Any,
AsyncIterator,
Expand Down Expand Up @@ -169,6 +170,14 @@ def pytest_configure(config: Config) -> None:
"run using an asyncio event loop",
)

if getattr(pytest, "__version_tuple__", (0, 0, 0) < (7,)):
warnings.warn(
"You're using an outdated version of pytest. Newer releases of "
"pytest-asyncio will not be compatible with this pytest version. "
"Please update pytest to version 7 or later.",
DeprecationWarning,
)


@pytest.mark.tryfirst
def pytest_report_header(config: Config) -> List[str]:
Expand Down

0 comments on commit d45ab21

Please sign in to comment.