Skip to content

Commit

Permalink
Pytest: Use get_closest_marker
Browse files Browse the repository at this point in the history
  • Loading branch information
hroncok authored and xavfernandez committed Apr 4, 2019
1 parent d35c547 commit d4264dc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down

0 comments on commit d4264dc

Please sign in to comment.