1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-31 18:40:56 +00:00

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.
This commit is contained in:
matejcik 2019-01-28 17:11:37 +01:00
parent 4afec2f3f3
commit 5355ce4879
2 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
-r requirements.txt
-r requirements-optional.txt
pytest>=3.2.5
pytest>=3.6
flake8
protobuf
isort

View File

@ -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.