conftest: add uses_pexpect mark
This commit is contained in:
parent
bce45052a6
commit
0025e4408f
|
@ -11,9 +11,10 @@ def pytest_collection_modifyitems(config, items):
|
||||||
"""
|
"""
|
||||||
fast_items = []
|
fast_items = []
|
||||||
slow_items = []
|
slow_items = []
|
||||||
|
slowest_items = []
|
||||||
neutral_items = []
|
neutral_items = []
|
||||||
|
|
||||||
slow_fixturenames = ("testdir",)
|
spawn_names = {"spawn_pytest", "spawn"}
|
||||||
|
|
||||||
for item in items:
|
for item in items:
|
||||||
try:
|
try:
|
||||||
|
@ -23,12 +24,16 @@ def pytest_collection_modifyitems(config, items):
|
||||||
# (https://github.com/pytest-dev/pytest/issues/5070)
|
# (https://github.com/pytest-dev/pytest/issues/5070)
|
||||||
neutral_items.append(item)
|
neutral_items.append(item)
|
||||||
else:
|
else:
|
||||||
if any(x for x in fixtures if x in slow_fixturenames):
|
if "testdir" in fixtures:
|
||||||
|
if spawn_names.intersection(item.function.__code__.co_names):
|
||||||
|
item.add_marker(pytest.mark.uses_pexpect)
|
||||||
slow_items.append(item)
|
slow_items.append(item)
|
||||||
|
else:
|
||||||
|
slowest_items.append(0)
|
||||||
else:
|
else:
|
||||||
marker = item.get_closest_marker("slow")
|
marker = item.get_closest_marker("slow")
|
||||||
if marker:
|
if marker:
|
||||||
slow_items.append(item)
|
slowest_items.append(item)
|
||||||
else:
|
else:
|
||||||
fast_items.append(item)
|
fast_items.append(item)
|
||||||
|
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -175,6 +175,8 @@ markers =
|
||||||
baz
|
baz
|
||||||
# conftest.py reorders tests moving slow ones to the end of the list
|
# conftest.py reorders tests moving slow ones to the end of the list
|
||||||
slow
|
slow
|
||||||
|
# experimental mark for all tests using pexpect
|
||||||
|
uses_pexpect
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
|
|
Loading…
Reference in New Issue