From 957ad27e525c2e87eb7ea92dbff0c3c5760e7dc0 Mon Sep 17 00:00:00 2001
From: M1nd3r <petrsedlacek.km@seznam.cz>
Date: Thu, 5 Dec 2024 11:52:04 +0100
Subject: [PATCH] feat(python): add lock() to TrezorClientDebugLink [no
 changelog]

---
 python/src/trezorlib/debuglink.py | 4 ++++
 tests/conftest.py                 | 1 +
 2 files changed, 5 insertions(+)

diff --git a/python/src/trezorlib/debuglink.py b/python/src/trezorlib/debuglink.py
index 0b612f5c9e..24ff3a602e 100644
--- a/python/src/trezorlib/debuglink.py
+++ b/python/src/trezorlib/debuglink.py
@@ -1445,6 +1445,10 @@ class TrezorClientDebugLink(TrezorClient):
         # TODO is this needed?
         # self.debug.close()
 
+    def lock(self) -> None:
+        s = SessionDebugWrapper(self.get_management_session())
+        s.lock()
+
     def get_session(
         self,
         passphrase: str | object | None = "",
diff --git a/tests/conftest.py b/tests/conftest.py
index 16a9cb18be..7f0ae69e2c 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -401,6 +401,7 @@ def client(
         if use_passphrase and isinstance(setup_params["passphrase"], str):
             _raw_client.use_passphrase(setup_params["passphrase"])
 
+        _raw_client.lock()
         # TODO _raw_client.clear_session()
 
     with ui_tests.screen_recording(_raw_client, request):