Remove 3.6 compatibility shims

- asyncio.all_tasks/current_task
- pytest-asyncio 0.17
- contextmanager.nullcontext
This commit is contained in:
Min RK
2022-07-13 16:48:09 -07:00
parent e8469af763
commit a7cced506b
5 changed files with 24 additions and 50 deletions

View File

@@ -54,28 +54,6 @@ from .utils import add_user
_db = None
def _pytest_collection_modifyitems(items):
"""This function is automatically run by pytest passing all collected test
functions.
We use it to add asyncio marker to all async tests and assert we don't use
test functions that are async generators which wouldn't make sense.
It is no longer required with pytest-asyncio >= 0.17
"""
for item in items:
if inspect.iscoroutinefunction(item.obj):
item.add_marker('asyncio')
assert not inspect.isasyncgenfunction(item.obj)
if sys.version_info < (3, 7):
# apply pytest-asyncio's 'auto' mode on Python 3.6.
# 'auto' mode is new in pytest-asyncio 0.17,
# which requires Python 3.7.
pytest_collection_modifyitems = _pytest_collection_modifyitems
@fixture(scope='module')
def ssl_tmpdir(tmpdir_factory):
return tmpdir_factory.mktemp('ssl')