mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-27 02:12:35 +00:00
refactor(tests): always use screen_recording context manager
and have it not record internally when appropriate
This commit is contained in:
parent
6af42b523d
commit
f62ce2f793
@ -226,10 +226,7 @@ def client(
|
|||||||
|
|
||||||
_raw_client.clear_session()
|
_raw_client.clear_session()
|
||||||
|
|
||||||
if test_ui:
|
with ui_tests.screen_recording(_raw_client, request):
|
||||||
with ui_tests.screen_recording(_raw_client, request):
|
|
||||||
yield _raw_client
|
|
||||||
else:
|
|
||||||
yield _raw_client
|
yield _raw_client
|
||||||
|
|
||||||
_raw_client.close()
|
_raw_client.close()
|
||||||
|
@ -127,6 +127,10 @@ def screen_recording(
|
|||||||
client: Client, request: pytest.FixtureRequest
|
client: Client, request: pytest.FixtureRequest
|
||||||
) -> Generator[None, None, None]:
|
) -> Generator[None, None, None]:
|
||||||
test_ui = request.config.getoption("ui")
|
test_ui = request.config.getoption("ui")
|
||||||
|
if not test_ui:
|
||||||
|
yield
|
||||||
|
return
|
||||||
|
|
||||||
test_name = get_test_name(request.node.nodeid)
|
test_name = get_test_name(request.node.nodeid)
|
||||||
|
|
||||||
# Differentiating test names between T1 and TT
|
# Differentiating test names between T1 and TT
|
||||||
@ -160,15 +164,14 @@ def screen_recording(
|
|||||||
client.init_device()
|
client.init_device()
|
||||||
client.debug.stop_recording()
|
client.debug.stop_recording()
|
||||||
|
|
||||||
if test_ui:
|
PROCESSED.add(test_name)
|
||||||
PROCESSED.add(test_name)
|
if get_last_call_test_result(request) is False:
|
||||||
if get_last_call_test_result(request) is False:
|
FAILED_TESTS.add(test_name)
|
||||||
FAILED_TESTS.add(test_name)
|
|
||||||
|
|
||||||
if test_ui == "record":
|
if test_ui == "record":
|
||||||
_process_recorded(screen_path, test_name)
|
_process_recorded(screen_path, test_name)
|
||||||
else:
|
else:
|
||||||
_process_tested(screens_test_path, test_name)
|
_process_tested(screens_test_path, test_name)
|
||||||
|
|
||||||
|
|
||||||
def list_missing() -> Set[str]:
|
def list_missing() -> Set[str]:
|
||||||
|
Loading…
Reference in New Issue
Block a user