1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-11 16:00:57 +00:00

tests: cleaner way to get the ui parameter

This commit is contained in:
matejcik 2020-05-19 10:00:37 +02:00 committed by matejcik
parent 4035aad51b
commit dab41fd680
2 changed files with 3 additions and 9 deletions

View File

@ -90,8 +90,6 @@ def client(request):
)
test_ui = request.config.getoption("ui")
if test_ui not in ("", "record", "test"):
raise ValueError("Invalid ui option.")
run_ui_tests = not request.node.get_closest_marker("skip_ui") and test_ui
client.open()
@ -195,7 +193,7 @@ def pytest_addoption(parser):
parser.addoption(
"--ui",
action="store",
default="",
choices=["test", "record"],
help="Enable UI intergration tests: 'record' or 'test'",
)
parser.addoption(

View File

@ -82,10 +82,8 @@ def screen_recording(client, request):
if test_ui == "record":
screen_path = screens_test_path / "recorded"
elif test_ui == "test":
screen_path = screens_test_path / "actual"
else:
raise ValueError("Invalid 'ui' option.")
screen_path = screens_test_path / "actual"
if not screens_test_path.exists():
screens_test_path.mkdir()
@ -98,10 +96,8 @@ def screen_recording(client, request):
yield
if test_ui == "record":
_process_recorded(screen_path, test_name)
elif test_ui == "test":
_process_tested(screens_test_path, test_name)
else:
raise ValueError("Invalid 'ui' option.")
_process_tested(screens_test_path, test_name)
finally:
client.debug.stop_recording()