Skip to content

Commit 2d8eab0

Browse files
committed
Pytest: Use get_closest_marker
See pytest-dev/pytest#4564
1 parent d35c547 commit 2d8eab0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/conftest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@ def pytest_collection_modifyitems(config, items):
3232
continue
3333

3434
# Mark network tests as flaky
35-
if item.get_marker('network') is not None and "CI" in os.environ:
35+
if (item.get_closest_marker('network') is not None and
36+
"CI" in os.environ):
3637
item.add_marker(pytest.mark.flaky(reruns=3))
3738

3839
if six.PY3:
39-
if (item.get_marker('incompatible_with_test_venv') and
40+
if (item.get_closest_marker('incompatible_with_test_venv') and
4041
config.getoption("--use-venv")):
4142
item.add_marker(pytest.mark.skip(
4243
'Incompatible with test venv'))
43-
if (item.get_marker('incompatible_with_venv') and
44+
if (item.get_closest_marker('incompatible_with_venv') and
4445
sys.prefix != sys.base_prefix):
4546
item.add_marker(pytest.mark.skip(
4647
'Incompatible with venv'))

0 commit comments

Comments
 (0)