tests: conftest: handle tests using runpytest_subprocess as "slowest"

This commit is contained in:
Daniel Hahler 2019-10-27 02:46:40 +01:00
parent ec27363748
commit d6e324a5e6
1 changed files with 4 additions and 1 deletions

View File

@ -39,9 +39,12 @@ def pytest_collection_modifyitems(config, items):
neutral_items.append(item) neutral_items.append(item)
else: else:
if "testdir" in fixtures: if "testdir" in fixtures:
if spawn_names.intersection(item.function.__code__.co_names): co_names = item.function.__code__.co_names
if spawn_names.intersection(co_names):
item.add_marker(pytest.mark.uses_pexpect) item.add_marker(pytest.mark.uses_pexpect)
slowest_items.append(item) slowest_items.append(item)
elif "runpytest_subprocess" in co_names:
slowest_items.append(item)
else: else:
slow_items.append(item) slow_items.append(item)
item.add_marker(pytest.mark.slow) item.add_marker(pytest.mark.slow)