Skip to content

Commit 081ad89

Browse files
authored
PYTHON-4894 Fix handling of auth test marker (mongodb#1958)
1 parent 4003edf commit 081ad89

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

test/pytest_conf.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33

44
def pytest_collection_modifyitems(items, config):
5-
sync_items = []
6-
async_items = [
7-
item
8-
for item in items
9-
if "asynchronous" in item.fspath.dirname or sync_items.append(item) # type: ignore[func-returns-value]
10-
]
11-
for item in async_items:
12-
if not any(item.iter_markers()):
13-
item.add_marker("default_async")
14-
for item in sync_items:
15-
if not any(item.iter_markers()):
16-
item.add_marker("default")
5+
# Markers that should overlap with the default markers.
6+
overlap_markers = ["async"]
7+
8+
for item in items:
9+
if "asynchronous" in item.fspath.dirname:
10+
default_marker = "default_async"
11+
else:
12+
default_marker = "default"
13+
markers = [m for m in item.iter_markers() if m not in overlap_markers]
14+
if not markers:
15+
item.add_marker(default_marker)

0 commit comments

Comments
 (0)