From 615219975288c1c6dace4da2b1c6b85e429b4fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 3 May 2019 12:18:03 +0200 Subject: [PATCH] Pytest 4: Update to get_closest_marker See https://docs.pytest.org/en/latest/mark.html#update-marker-code --- news/3724.trivial.rst | 1 + tests/integration/conftest.py | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 news/3724.trivial.rst diff --git a/news/3724.trivial.rst b/news/3724.trivial.rst new file mode 100644 index 00000000..63a55013 --- /dev/null +++ b/news/3724.trivial.rst @@ -0,0 +1 @@ +Update pytest configuration to support pytest 4. diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 766291e8..a687abb7 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -88,21 +88,21 @@ prepare_fixtures(os.path.join(PYPI_VENDOR_DIR, "fixtures")) def pytest_runtest_setup(item): - if item.get_marker('needs_internet') is not None and not WE_HAVE_INTERNET: + if item.get_closest_marker('needs_internet') is not None and not WE_HAVE_INTERNET: pytest.skip('requires internet') - if item.get_marker('needs_github_ssh') is not None and not WE_HAVE_GITHUB_SSH_KEYS: + if item.get_closest_marker('needs_github_ssh') is not None and not WE_HAVE_GITHUB_SSH_KEYS: pytest.skip('requires github ssh') - if item.get_marker('needs_hg') is not None and not WE_HAVE_HG: + if item.get_closest_marker('needs_hg') is not None and not WE_HAVE_HG: pytest.skip('requires mercurial') - if item.get_marker('skip_py27_win') is not None and ( + if item.get_closest_marker('skip_py27_win') is not None and ( sys.version_info[:2] <= (2, 7) and os.name == "nt" ): pytest.skip('must use python > 2.7 on windows') - if item.get_marker('py3_only') is not None and ( + if item.get_closest_marker('py3_only') is not None and ( sys.version_info < (3, 0) ): pytest.skip('test only runs on python 3') - if item.get_marker('lte_py36') is not None and ( + if item.get_closest_marker('lte_py36') is not None and ( sys.version_info >= (3, 7) ): pytest.skip('test only runs on python < 3.7')