Skip to content

Commit 7379ca4

Browse files
committed
conftest: add uses_pexpect mark
1 parent e393a73 commit 7379ca4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

testing/conftest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def pytest_collection_modifyitems(config, items):
1414
neutral_items = []
1515

1616
slow_fixturenames = ("testdir",)
17+
spawn_names = {"spawn_pytest", "spawn"}
1718

1819
for item in items:
1920
try:
@@ -23,7 +24,12 @@ def pytest_collection_modifyitems(config, items):
2324
# (https://github.com/pytest-dev/pytest/issues/5070)
2425
neutral_items.append(item)
2526
else:
26-
if any(x for x in fixtures if x in slow_fixturenames):
27+
if "testdir" in fixtures and spawn_names.intersection(
28+
item.function.__code__.co_names
29+
):
30+
slow_items.append(item)
31+
item.add_marker(pytest.mark.uses_pexpect)
32+
elif any(x for x in fixtures if x in slow_fixturenames):
2733
slow_items.append(item)
2834
else:
2935
marker = item.get_closest_marker("slow")

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ markers =
175175
baz
176176
# conftest.py reorders tests moving slow ones to the end of the list
177177
slow
178+
uses_pexpect
178179

179180
[flake8]
180181
max-line-length = 120

0 commit comments

Comments
 (0)