From d9efd92c0adb41b41f876def4721248b85f2672a Mon Sep 17 00:00:00 2001 From: matejcik Date: Mon, 21 Oct 2019 11:46:32 +0200 Subject: [PATCH] tests: error-out sd_card tests without SD card --- tests/conftest.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 25493f4459..faa1ad2508 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -77,6 +77,16 @@ def client(request): if request.node.get_closest_marker("skip_t1") and client.features.model == "1": pytest.skip("Test excluded on Trezor 1") + if ( + request.node.get_closest_marker("sd_card") + and not client.features.sd_card_present + ): + raise RuntimeError( + "This test requires SD card.\n" + "To skip all such tests, run:\n" + " pytest -m 'not sd_card' " + ) + wipe_device(client) # fmt: off @@ -141,7 +151,7 @@ def pytest_runtest_setup(item): both T1 and TT. """ if item.get_closest_marker("skip_t1") and item.get_closest_marker("skip_t2"): - pytest.fail("Don't skip tests for both trezors!") + raise RuntimeError("Don't skip tests for both trezors!") skip_altcoins = int(os.environ.get("TREZOR_PYTEST_SKIP_ALTCOINS", 0)) if item.get_closest_marker("altcoin") and skip_altcoins: