mirror of https://github.com/scrapy/scrapy.git
Enable skipping tests based on --reactor.
This commit is contained in:
parent
a1605cade6
commit
2db7d45378
|
|
@ -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
|
||||
|
||||
|
||||
@pytest.fixture(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')
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ addopts =
|
|||
--ignore=docs/topics/telnetconsole.rst
|
||||
--ignore=docs/utils
|
||||
twisted = 1
|
||||
markers =
|
||||
only_asyncio: marks tests as only enabled when --reactor=asyncio is passed
|
||||
flake8-ignore =
|
||||
# Files that are only meant to provide top-level imports are expected not
|
||||
# to use any of their imports:
|
||||
|
|
|
|||
Loading…
Reference in New Issue