Pytest: Use get_closest_marker

See https://github.com/pytest-dev/pytest/pull/4564
This commit is contained in:
Miro Hrončok 2019-03-29 18:36:45 +01:00 committed by Xavier Fernandez
parent d35c547129
commit d4264dc3b2
1 changed files with 4 additions and 3 deletions

View File

@ -32,15 +32,16 @@ def pytest_collection_modifyitems(config, items):
continue
# Mark network tests as flaky
if item.get_marker('network') is not None and "CI" in os.environ:
if (item.get_closest_marker('network') is not None and
"CI" in os.environ):
item.add_marker(pytest.mark.flaky(reruns=3))
if six.PY3:
if (item.get_marker('incompatible_with_test_venv') and
if (item.get_closest_marker('incompatible_with_test_venv') and
config.getoption("--use-venv")):
item.add_marker(pytest.mark.skip(
'Incompatible with test venv'))
if (item.get_marker('incompatible_with_venv') and
if (item.get_closest_marker('incompatible_with_venv') and
sys.prefix != sys.base_prefix):
item.add_marker(pytest.mark.skip(
'Incompatible with venv'))