mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-08-02 11:58:32 +00:00
TR-tests: add skip_tr pytest mark
This commit is contained in:
parent
e809dfab73
commit
d563ea1cbe
@ -105,9 +105,11 @@ the following marker:
|
|||||||
|
|
||||||
This marker must be registered in `REGISTERED_MARKERS` file in `tests` folder.
|
This marker must be registered in `REGISTERED_MARKERS` file in `tests` folder.
|
||||||
|
|
||||||
If you wish to run a test only on TT, mark it with `@pytest.mark.skip_t1`.
|
Tests can be run only for specific models - it is done by disallowing the tests for the other models.
|
||||||
If the test should only run on T1, mark it with `@pytest.mark.skip_t2`.
|
`@pytest.mark.skip_t1`
|
||||||
You must not use both on the same test.
|
`@pytest.mark.skip_t2`
|
||||||
|
`@pytest.mark.skip_tr`
|
||||||
|
are valid markers to skip current test for T1, TT and TR respectively.
|
||||||
|
|
||||||
[pytest-random-order]: https://pypi.org/project/pytest-random-order/
|
[pytest-random-order]: https://pypi.org/project/pytest-random-order/
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ def client(
|
|||||||
Every test function that requires a client instance will get it from here.
|
Every test function that requires a client instance will get it from here.
|
||||||
If we can't connect to a debuggable device, the test will fail.
|
If we can't connect to a debuggable device, the test will fail.
|
||||||
If 'skip_t2' is used and TT is connected, the test is skipped. Vice versa with T1
|
If 'skip_t2' is used and TT is connected, the test is skipped. Vice versa with T1
|
||||||
and 'skip_t1'.
|
and 'skip_t1'. Same with TR.
|
||||||
|
|
||||||
The client instance is wiped and preconfigured with "all all all..." mnemonic, no
|
The client instance is wiped and preconfigured with "all all all..." mnemonic, no
|
||||||
password and no pin. It is possible to customize this with the `setup_client`
|
password and no pin. It is possible to customize this with the `setup_client`
|
||||||
@ -179,6 +179,8 @@ def client(
|
|||||||
pytest.skip("Test excluded on Trezor T")
|
pytest.skip("Test excluded on Trezor T")
|
||||||
if request.node.get_closest_marker("skip_t1") and _raw_client.features.model == "1":
|
if request.node.get_closest_marker("skip_t1") and _raw_client.features.model == "1":
|
||||||
pytest.skip("Test excluded on Trezor 1")
|
pytest.skip("Test excluded on Trezor 1")
|
||||||
|
if request.node.get_closest_marker("skip_tr") and _raw_client.features.model == "R":
|
||||||
|
pytest.skip("Test excluded on Trezor R")
|
||||||
|
|
||||||
sd_marker = request.node.get_closest_marker("sd_card")
|
sd_marker = request.node.get_closest_marker("sd_card")
|
||||||
if sd_marker and not _raw_client.features.sd_card_present:
|
if sd_marker and not _raw_client.features.sd_card_present:
|
||||||
@ -338,6 +340,7 @@ def pytest_configure(config: "Config") -> None:
|
|||||||
# register known markers
|
# register known markers
|
||||||
config.addinivalue_line("markers", "skip_t1: skip the test on Trezor One")
|
config.addinivalue_line("markers", "skip_t1: skip the test on Trezor One")
|
||||||
config.addinivalue_line("markers", "skip_t2: skip the test on Trezor T")
|
config.addinivalue_line("markers", "skip_t2: skip the test on Trezor T")
|
||||||
|
config.addinivalue_line("markers", "skip_tr: skip the test on Trezor R")
|
||||||
config.addinivalue_line(
|
config.addinivalue_line(
|
||||||
"markers", "experimental: enable experimental features on Trezor"
|
"markers", "experimental: enable experimental features on Trezor"
|
||||||
)
|
)
|
||||||
@ -360,8 +363,10 @@ def pytest_runtest_setup(item: pytest.Item) -> None:
|
|||||||
Ensures that altcoin tests are skipped, and that no test is skipped on
|
Ensures that altcoin tests are skipped, and that no test is skipped on
|
||||||
both T1 and TT.
|
both T1 and TT.
|
||||||
"""
|
"""
|
||||||
if item.get_closest_marker("skip_t1") and item.get_closest_marker("skip_t2"):
|
if all(
|
||||||
raise RuntimeError("Don't skip tests for both trezors!")
|
item.get_closest_marker(marker) for marker in ("skip_t1", "skip_t2", "skip_tr")
|
||||||
|
):
|
||||||
|
raise RuntimeError("Don't skip tests for all trezor models!")
|
||||||
|
|
||||||
skip_altcoins = int(os.environ.get("TREZOR_PYTEST_SKIP_ALTCOINS", 0))
|
skip_altcoins = int(os.environ.get("TREZOR_PYTEST_SKIP_ALTCOINS", 0))
|
||||||
if item.get_closest_marker("altcoin") and skip_altcoins:
|
if item.get_closest_marker("altcoin") and skip_altcoins:
|
||||||
|
Loading…
Reference in New Issue
Block a user