diff --git a/dependencies/default/requirements.txt b/dependencies/default/requirements.txt index 01b2484e..a0009a85 100644 --- a/dependencies/default/requirements.txt +++ b/dependencies/default/requirements.txt @@ -1,4 +1,4 @@ # Always adjust install_requires in setup.cfg and pytest-min-requirements.txt # when changing runtime dependencies -pytest >= 6.1.0 +pytest >= 7.0.0 typing-extensions >= 3.7.2; python_version < "3.8" diff --git a/dependencies/pytest-min/constraints.txt b/dependencies/pytest-min/constraints.txt index 33f7948f..1f82dbaf 100644 --- a/dependencies/pytest-min/constraints.txt +++ b/dependencies/pytest-min/constraints.txt @@ -1,22 +1,22 @@ -async-generator==1.10 -attrs==21.4.0 -coverage==6.3.2 -flaky==3.7.0 -hypothesis==6.43.3 -idna==3.3 +argcomplete==2.0.0 +attrs==22.1.0 +certifi==2022.9.24 +charset-normalizer==2.1.1 +elementpath==3.0.2 +exceptiongroup==1.0.0rc9 +hypothesis==6.56.3 +idna==3.4 iniconfig==1.1.1 -mypy==0.942 -mypy-extensions==0.4.3 -outcome==1.1.0 +mock==4.0.3 +nose==1.3.7 packaging==21.3 -pluggy==0.13.1 +pluggy==1.0.0 py==1.11.0 -pyparsing==3.0.8 -pytest==6.1.0 -pytest-trio==0.7.0 -sniffio==1.2.0 +Pygments==2.13.0 +pyparsing==3.0.9 +pytest==7.0.0 +requests==2.28.1 sortedcontainers==2.4.0 -toml==0.10.2 tomli==2.0.1 -trio==0.20.0 -typing_extensions==4.2.0 +urllib3==1.26.12 +xmlschema==2.1.1 diff --git a/dependencies/pytest-min/requirements.txt b/dependencies/pytest-min/requirements.txt index 4fc6ef2f..4152d2f8 100644 --- a/dependencies/pytest-min/requirements.txt +++ b/dependencies/pytest-min/requirements.txt @@ -1,4 +1,4 @@ # Always adjust install_requires in setup.cfg and requirements.txt # when changing minimum version dependencies -pytest == 6.1.0 +pytest[testing] == 7.0.0 typing-extensions >= 3.7.2; python_version < "3.8" diff --git a/docs/source/reference/changelog.rst b/docs/source/reference/changelog.rst index e6f80383..af4eb7bf 100644 --- a/docs/source/reference/changelog.rst +++ b/docs/source/reference/changelog.rst @@ -2,6 +2,10 @@ Changelog ========= +UNRELEASED +================= +- Drop compatibility with pytest 6.1. Pytest-asyncio now depends on pytest 7.0 or newer. + 0.20.3 (22-12-08) ================= - Prevent DeprecationWarning to bubble up on CPython 3.10.9 and 3.11.1. diff --git a/pytest_asyncio/plugin.py b/pytest_asyncio/plugin.py index 403d814f..f663ff68 100644 --- a/pytest_asyncio/plugin.py +++ b/pytest_asyncio/plugin.py @@ -25,7 +25,15 @@ ) import pytest -from pytest import Function, Item, Session +from pytest import ( + Config, + FixtureRequest, + Function, + Item, + Parser, + PytestPluginManager, + Session, +) if sys.version_info >= (3, 8): from typing import Literal @@ -46,11 +54,9 @@ FixtureFunction = Union[SimpleFixtureFunction, FactoryFixtureFunction] FixtureFunctionMarker = Callable[[FixtureFunction], FixtureFunction] -Config = Any # pytest < 7.0 -PytestPluginManager = Any # pytest < 7.0 -FixtureDef = Any # pytest < 7.0 -Parser = Any # pytest < 7.0 -SubRequest = Any # pytest < 7.0 +# https://github.com/pytest-dev/pytest/pull/9510 +FixtureDef = Any +SubRequest = Any class Mode(str, enum.Enum): @@ -169,14 +175,6 @@ 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.hookimpl(tryfirst=True) def pytest_report_header(config: Config) -> List[str]: @@ -508,7 +506,7 @@ def pytest_runtest_setup(item: pytest.Item) -> None: @pytest.fixture -def event_loop(request: "pytest.FixtureRequest") -> Iterator[asyncio.AbstractEventLoop]: +def event_loop(request: FixtureRequest) -> Iterator[asyncio.AbstractEventLoop]: """Create an instance of the default event loop for each test case.""" loop = asyncio.get_event_loop_policy().new_event_loop() yield loop diff --git a/setup.cfg b/setup.cfg index a82c57e1..ee57438c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -40,7 +40,7 @@ include_package_data = True # Always adjust requirements.txt and pytest-min-requirements.txt when changing runtime dependencies install_requires = - pytest >= 6.1.0 + pytest >= 7.0.0 typing-extensions >= 3.7.2; python_version < "3.8" [options.extras_require] diff --git a/tests/test_pytest_min_version_warning.py b/tests/test_pytest_min_version_warning.py deleted file mode 100644 index 5f7bd72f..00000000 --- a/tests/test_pytest_min_version_warning.py +++ /dev/null @@ -1,26 +0,0 @@ -from textwrap import dedent - -import pytest - - -@pytest.mark.skipif( - pytest.__version__ < "7.0.0", - reason="The warning shouldn't be present when run with recent pytest versions", -) -@pytest.mark.parametrize("mode", ("auto", "strict")) -def test_pytest_min_version_warning_is_not_triggered_for_pytest_7(testdir, mode): - testdir.makepyfile( - dedent( - """\ - import pytest - - pytest_plugins = 'pytest_asyncio' - - @pytest.mark.asyncio - async def test_triggers_pytest_warning(): - pass - """ - ) - ) - result = testdir.runpytest(f"--asyncio-mode={mode}") - result.assert_outcomes(passed=1, warnings=0)