From 5355ce48798d85c8bb501fe2c161df6f5b837e2b Mon Sep 17 00:00:00 2001 From: matejcik Date: Mon, 28 Jan 2019 17:11:37 +0100 Subject: [PATCH] device_tests: upgrade get_marker to get_closest_marker This bumps pytest requirement to 3.6. But we have that everywhere already. For bonus points, get_closest_marker still exists in 4.1. --- requirements-dev.txt | 2 +- trezorlib/tests/device_tests/conftest.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 8086112ad..2ac5dd064 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,6 @@ -r requirements.txt -r requirements-optional.txt -pytest>=3.2.5 +pytest>=3.6 flake8 protobuf isort diff --git a/trezorlib/tests/device_tests/conftest.py b/trezorlib/tests/device_tests/conftest.py index 7bdfc2dad..bfc5d5cf2 100644 --- a/trezorlib/tests/device_tests/conftest.py +++ b/trezorlib/tests/device_tests/conftest.py @@ -111,17 +111,17 @@ def pytest_runtest_setup(item): * no test should have both skips at the same time * allows to 'runxfail' tests specified by 'run_xfail' in pytest.ini """ - if item.get_marker("skip_t1") and item.get_marker("skip_t2"): + if item.get_closest_marker("skip_t1") and item.get_closest_marker("skip_t2"): pytest.fail("Don't skip tests for both trezors!") - if item.get_marker("skip_t2") and TREZOR_VERSION == 2: + if item.get_closest_marker("skip_t2") and TREZOR_VERSION == 2: pytest.skip("Test excluded on Trezor T") - if item.get_marker("skip_t1") and TREZOR_VERSION == 1: + if item.get_closest_marker("skip_t1") and TREZOR_VERSION == 1: pytest.skip("Test excluded on Trezor 1") - xfail = item.get_marker("xfail") + xfail = item.get_closest_marker("xfail") runxfail_markers = item.config.getini("run_xfail") - run_xfail = any(item.get_marker(marker) for marker in runxfail_markers) + run_xfail = any(item.get_closest_marker(marker) for marker in runxfail_markers) if xfail and run_xfail: # Deep hack: pytest's private _evalxfail helper determines whether the test should xfail or not. # The helper caches its result even before this hook runs.