From c567fb8bc33a9f720f47419d09afc1cb747d071c Mon Sep 17 00:00:00 2001 From: Tomer Keren Date: Sun, 6 Jan 2019 22:45:50 +0200 Subject: [PATCH 1/3] Remove transfer_markers Closes #104 Tests still pass - am I missing anything? --- pytest_asyncio/plugin.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pytest_asyncio/plugin.py b/pytest_asyncio/plugin.py index 26a37d48..6a35ae99 100644 --- a/pytest_asyncio/plugin.py +++ b/pytest_asyncio/plugin.py @@ -6,7 +6,6 @@ import socket import pytest -from _pytest.python import transfer_markers try: from async_generator import isasyncgenfunction @@ -36,7 +35,6 @@ def pytest_pycollect_makeitem(collector, name, obj): # Due to how pytest test collection works, module-level pytestmarks # are applied after the collection step. Since this is the collection # step, we look ourselves. - transfer_markers(obj, item.cls, item.module) item = pytest.Function(name, parent=collector) # To reload keywords. if 'asyncio' in item.keywords: From e868913caf8f8a1187264580472536b7691ab9b7 Mon Sep 17 00:00:00 2001 From: Tomer Keren Date: Sun, 6 Jan 2019 23:55:14 +0200 Subject: [PATCH 2/3] Revert "Remove transfer_markers" This reverts commit c567fb8bc33a9f720f47419d09afc1cb747d071c. --- pytest_asyncio/plugin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pytest_asyncio/plugin.py b/pytest_asyncio/plugin.py index 6a35ae99..26a37d48 100644 --- a/pytest_asyncio/plugin.py +++ b/pytest_asyncio/plugin.py @@ -6,6 +6,7 @@ import socket import pytest +from _pytest.python import transfer_markers try: from async_generator import isasyncgenfunction @@ -35,6 +36,7 @@ def pytest_pycollect_makeitem(collector, name, obj): # Due to how pytest test collection works, module-level pytestmarks # are applied after the collection step. Since this is the collection # step, we look ourselves. + transfer_markers(obj, item.cls, item.module) item = pytest.Function(name, parent=collector) # To reload keywords. if 'asyncio' in item.keywords: From 2c8023d5e123644a1990dcf978b527ddafeca8f7 Mon Sep 17 00:00:00 2001 From: Tomer Keren Date: Sun, 6 Jan 2019 23:59:07 +0200 Subject: [PATCH 3/3] Make transfer_markers a noop when importing fails --- pytest_asyncio/plugin.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pytest_asyncio/plugin.py b/pytest_asyncio/plugin.py index 26a37d48..9f4e10d7 100644 --- a/pytest_asyncio/plugin.py +++ b/pytest_asyncio/plugin.py @@ -6,7 +6,12 @@ import socket import pytest -from _pytest.python import transfer_markers +try: + from _pytest.python import transfer_markers +except ImportError: # Pytest 4.1.0 removes the transfer_marker api (#104) + def transfer_markers(*args, **kwargs): # noqa + """Noop when over pytest 4.1.0""" + pass try: from async_generator import isasyncgenfunction