Prepare the splitting of the "test key loading" fixture function
Marco Ricci

Marco Ricci commited on 2025-12-27 14:57:17
Zeige 1 geänderte Dateien mit 5 Einfügungen und 3 Löschungen.


The `ssh_agent_client_with_test_keys_loaded` fixture function is due to
be split, moving the upload bits and the `prepare_payload` function to
new top-level helper functions.  Rename the `prepare_payload` function,
and add parameter definitions so that the extracted functions will make
immediate sense.
... ...
@@ -883,7 +883,7 @@ def ssh_agent_client_with_test_keys_loaded(  # noqa: C901
883 883
     #
884 884
     # (But see below, too.)
885 885
 
886
-    def prepare_payload(
886
+    def _prepare_payload(
887 887
         payload: bytes | bytearray,
888 888
         *,
889 889
         isolated: bool = True,
... ...
@@ -901,12 +901,14 @@ def ssh_agent_client_with_test_keys_loaded(  # noqa: C901
901 901
         )
902 902
         return (return_code, bytes(payload) + lifetime_constraint)
903 903
 
904
+    spawned_agent_info = spawn_ssh_agent
904 905
     try:
905 906
         for key_type, key_struct in data.ALL_KEYS.items():
907
+            agent_type, client, isolated = spawned_agent_info
906 908
             private_key_data = key_struct.private_key_blob
907 909
             if private_key_data is None:  # pragma: no cover [failsafe]
908 910
                 continue
909
-            request_code, payload = prepare_payload(
911
+            request_code, payload = _prepare_payload(
910 912
                 private_key_data, isolated=isolated, time_to_live=30
911 913
             )
912 914
             try:
... ...
@@ -941,7 +943,7 @@ def ssh_agent_client_with_test_keys_loaded(  # noqa: C901
941 943
                         agent_type == data.KnownSSHAgent.UNIXPageant
942 944
                         and not isolated
943 945
                     ):
944
-                        request_code, payload = prepare_payload(
946
+                        request_code, payload = _prepare_payload(
945 947
                             private_key_data, isolated=True
946 948
                         )
947 949
                         client.request(
948 950