mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-25 23:01:02 +00:00
tests: cleaner way to get the ui parameter
This commit is contained in:
parent
4035aad51b
commit
dab41fd680
@ -90,8 +90,6 @@ def client(request):
|
|||||||
)
|
)
|
||||||
|
|
||||||
test_ui = request.config.getoption("ui")
|
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
|
run_ui_tests = not request.node.get_closest_marker("skip_ui") and test_ui
|
||||||
|
|
||||||
client.open()
|
client.open()
|
||||||
@ -195,7 +193,7 @@ def pytest_addoption(parser):
|
|||||||
parser.addoption(
|
parser.addoption(
|
||||||
"--ui",
|
"--ui",
|
||||||
action="store",
|
action="store",
|
||||||
default="",
|
choices=["test", "record"],
|
||||||
help="Enable UI intergration tests: 'record' or 'test'",
|
help="Enable UI intergration tests: 'record' or 'test'",
|
||||||
)
|
)
|
||||||
parser.addoption(
|
parser.addoption(
|
||||||
|
@ -82,10 +82,8 @@ def screen_recording(client, request):
|
|||||||
|
|
||||||
if test_ui == "record":
|
if test_ui == "record":
|
||||||
screen_path = screens_test_path / "recorded"
|
screen_path = screens_test_path / "recorded"
|
||||||
elif test_ui == "test":
|
|
||||||
screen_path = screens_test_path / "actual"
|
|
||||||
else:
|
else:
|
||||||
raise ValueError("Invalid 'ui' option.")
|
screen_path = screens_test_path / "actual"
|
||||||
|
|
||||||
if not screens_test_path.exists():
|
if not screens_test_path.exists():
|
||||||
screens_test_path.mkdir()
|
screens_test_path.mkdir()
|
||||||
@ -98,10 +96,8 @@ def screen_recording(client, request):
|
|||||||
yield
|
yield
|
||||||
if test_ui == "record":
|
if test_ui == "record":
|
||||||
_process_recorded(screen_path, test_name)
|
_process_recorded(screen_path, test_name)
|
||||||
elif test_ui == "test":
|
|
||||||
_process_tested(screens_test_path, test_name)
|
|
||||||
else:
|
else:
|
||||||
raise ValueError("Invalid 'ui' option.")
|
_process_tested(screens_test_path, test_name)
|
||||||
finally:
|
finally:
|
||||||
client.debug.stop_recording()
|
client.debug.stop_recording()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user