Skip to content

Commit c35544a

Browse files
author
Bruno Oliveira
authored
conftest: add uses_pexpect mark (#5314)
conftest: add uses_pexpect mark
2 parents 81cc731 + 0025e44 commit c35544a

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

testing/conftest.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ def pytest_collection_modifyitems(config, items):
1111
"""
1212
fast_items = []
1313
slow_items = []
14+
slowest_items = []
1415
neutral_items = []
1516

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

1819
for item in items:
1920
try:
@@ -23,12 +24,16 @@ 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-
slow_items.append(item)
27+
if "testdir" in fixtures:
28+
if spawn_names.intersection(item.function.__code__.co_names):
29+
item.add_marker(pytest.mark.uses_pexpect)
30+
slow_items.append(item)
31+
else:
32+
slowest_items.append(0)
2833
else:
2934
marker = item.get_closest_marker("slow")
3035
if marker:
31-
slow_items.append(item)
36+
slowest_items.append(item)
3237
else:
3338
fast_items.append(item)
3439

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ markers =
175175
baz
176176
# conftest.py reorders tests moving slow ones to the end of the list
177177
slow
178+
# experimental mark for all tests using pexpect
179+
uses_pexpect
178180

179181
[flake8]
180182
max-line-length = 120

0 commit comments

Comments
 (0)