Scrapy, a fast high-level web crawling & scraping framework for Python.
Enable skipping tests based on --reactor.
Andrey Rakhmatullin2db7d453788f
diff --git a/conftest.py b/conftest.pyindex 64136b48d..56d552953 100644--- a/conftest.py+++ b/conftest.py@@ -35,6 +35,14 @@ def pytest_collection_modifyitems(session, config, items):except ImportError:pass+@pytest.fixture()def reactor_pytest(request):request.cls.reactor_pytest = request.config.getoption("--reactor")+ return request.cls.reactor_pytest++[email protected](autouse=True)+def only_asyncio(request, reactor_pytest):+ if request.node.get_closest_marker('only_asyncio') and reactor_pytest != 'asyncio':+ pytest.skip('This test is only run with --reactor-asyncio')diff --git a/pytest.ini b/pytest.iniindex 336ef041d..7b62a1bd8 100644--- a/pytest.ini+++ b/pytest.ini@@ -19,6 +19,8 @@ addopts =--ignore=docs/topics/telnetconsole.rst--ignore=docs/utilstwisted = 1+markers =+ only_asyncio: marks tests as only enabled when --reactor=asyncio is passedflake8-ignore =# Files that are only meant to provide top-level imports are expected not# to use any of their imports: