|
6 | 6 | import inspect |
7 | 7 | import socket |
8 | 8 | import sys |
9 | | -import warnings |
10 | 9 | from typing import ( |
11 | 10 | Any, |
12 | 11 | AsyncIterator, |
|
55 | 54 | class Mode(str, enum.Enum): |
56 | 55 | AUTO = "auto" |
57 | 56 | STRICT = "strict" |
58 | | - LEGACY = "legacy" |
59 | | - |
60 | | - |
61 | | -LEGACY_MODE = DeprecationWarning( |
62 | | - "The 'asyncio_mode' default value will change to 'strict' in future, " |
63 | | - "please explicitly use 'asyncio_mode=strict' or 'asyncio_mode=auto' " |
64 | | - "in pytest configuration file." |
65 | | -) |
66 | | - |
67 | | -LEGACY_ASYNCIO_FIXTURE = ( |
68 | | - "'@pytest.fixture' is applied to {name} " |
69 | | - "in 'legacy' mode, " |
70 | | - "please replace it with '@pytest_asyncio.fixture' as a preparation " |
71 | | - "for switching to 'strict' mode (or use 'auto' mode to seamlessly handle " |
72 | | - "all these fixtures as asyncio-driven)." |
73 | | -) |
74 | 57 |
|
75 | 58 |
|
76 | 59 | ASYNCIO_MODE_HELP = """\ |
77 | 60 | 'auto' - for automatically handling all async functions by the plugin |
78 | 61 | 'strict' - for autoprocessing disabling (useful if different async frameworks \ |
79 | 62 | should be tested together, e.g. \ |
80 | 63 | both pytest-asyncio and pytest-trio are used in the same project) |
81 | | -'legacy' - for keeping compatibility with pytest-asyncio<0.17: \ |
82 | | -auto-handling is disabled but pytest_asyncio.fixture usage is not enforced |
83 | 64 | """ |
84 | 65 |
|
85 | 66 |
|
@@ -187,8 +168,6 @@ def pytest_configure(config: Config) -> None: |
187 | 168 | "mark the test as a coroutine, it will be " |
188 | 169 | "run using an asyncio event loop", |
189 | 170 | ) |
190 | | - if _get_asyncio_mode(config) == Mode.LEGACY: |
191 | | - config.issue_config_time_warning(LEGACY_MODE, stacklevel=2) |
192 | 171 |
|
193 | 172 |
|
194 | 173 | @pytest.mark.tryfirst |
@@ -217,20 +196,6 @@ def _preprocess_async_fixtures(config: Config, holder: Set[FixtureDef]) -> None: |
217 | 196 | elif asyncio_mode == Mode.AUTO: |
218 | 197 | # Enforce asyncio mode if 'auto' |
219 | 198 | _set_explicit_asyncio_mark(func) |
220 | | - elif asyncio_mode == Mode.LEGACY: |
221 | | - _set_explicit_asyncio_mark(func) |
222 | | - try: |
223 | | - code = func.__code__ |
224 | | - except AttributeError: |
225 | | - code = func.__func__.__code__ |
226 | | - name = ( |
227 | | - f"<fixture {func.__qualname__}, file={code.co_filename}, " |
228 | | - f"line={code.co_firstlineno}>" |
229 | | - ) |
230 | | - warnings.warn( |
231 | | - LEGACY_ASYNCIO_FIXTURE.format(name=name), |
232 | | - DeprecationWarning, |
233 | | - ) |
234 | 199 |
|
235 | 200 | to_add = [] |
236 | 201 | for name in ("request", "event_loop"): |
|
0 commit comments