Marco Ricci commited on 2025-11-26 20:50:58
Zeige 1 geänderte Dateien mit 24 Einfügungen und 29 Löschungen.
The broken tests relate to SSH agent handling. We now have a fake SSH agent, and I mistakenly believed that because this agent is always available, tests no longer needed to ensure agent accessibility; the fake agent would always be available. But that's not how the SSH agent test fixture works: you still need to explicitly *request* the agent as part of your setup. Otherwise you will run into the usual "no agent could be located" or "no agent is supported on this system" error situations (which is exactly what was happening on The Annoying OS). The only thing that really changed is that we now know that *some* of the test fixture instances (the ones with fake agents) will not auto-skip due to lack of support.
| ... | ... |
@@ -781,13 +781,16 @@ class TestStoringConfigurationFailures: |
| 781 | 781 |
cli_helpers, "prompt_for_selection", prompt_for_selection |
| 782 | 782 |
) |
| 783 | 783 |
|
| 784 |
- def test_fail_because_no_ssh_agent(self) -> None: |
|
| 784 |
+ def test_fail_because_no_ssh_agent( |
|
| 785 |
+ self, spawn_ssh_agent: data.SpawnedSSHAgentInfo |
|
| 786 |
+ ) -> None: |
|
| 785 | 787 |
"""Not running an SSH agent during `--config --key` fails. |
| 786 | 788 |
|
| 787 | 789 |
(This test does not actually need a running agent; the agent's |
| 788 | 790 |
response is mocked by the test harness.) |
| 789 | 791 |
|
| 790 | 792 |
""" |
| 793 |
+ del spawn_ssh_agent |
|
| 791 | 794 |
with self._test( |
| 792 | 795 |
["--key"], |
| 793 | 796 |
error_text="Cannot find any running SSH agent", |
| ... | ... |
@@ -795,13 +798,11 @@ class TestStoringConfigurationFailures: |
| 795 | 798 |
) as monkeypatch: |
| 796 | 799 |
monkeypatch.delenv("SSH_AUTH_SOCK", raising=False)
|
| 797 | 800 |
|
| 798 |
- def test_fail_because_bad_ssh_agent_connection(self) -> None: |
|
| 799 |
- """Not running a reachable SSH agent during `--config --key` fails. |
|
| 800 |
- |
|
| 801 |
- (This test does not actually need a running agent; the agent's |
|
| 802 |
- response is mocked by the test harness.) |
|
| 803 |
- |
|
| 804 |
- """ |
|
| 801 |
+ def test_fail_because_bad_ssh_agent_connection( |
|
| 802 |
+ self, spawn_ssh_agent: data.SpawnedSSHAgentInfo |
|
| 803 |
+ ) -> None: |
|
| 804 |
+ """Not running a reachable SSH agent during `--config --key` fails.""" |
|
| 805 |
+ del spawn_ssh_agent |
|
| 805 | 806 |
with self._test( |
| 806 | 807 |
["--key"], |
| 807 | 808 |
error_text="Cannot connect to the SSH agent", |
| ... | ... |
@@ -845,13 +846,11 @@ class TestStoringConfigurationFailures: |
| 845 | 846 |
): |
| 846 | 847 |
pass |
| 847 | 848 |
|
| 848 |
- def test_fail_because_ssh_agent_has_no_keys_loaded(self) -> None: |
|
| 849 |
- """Not holding any SSH keys during `--config --key` fails. |
|
| 850 |
- |
|
| 851 |
- (This test does not actually need a running agent; the agent's |
|
| 852 |
- response is mocked by the test harness.) |
|
| 853 |
- |
|
| 854 |
- """ |
|
| 849 |
+ def test_fail_because_ssh_agent_has_no_keys_loaded( |
|
| 850 |
+ self, spawn_ssh_agent: data.SpawnedSSHAgentInfo |
|
| 851 |
+ ) -> None: |
|
| 852 |
+ """Not holding any SSH keys during `--config --key` fails.""" |
|
| 853 |
+ del spawn_ssh_agent |
|
| 855 | 854 |
with self._test( |
| 856 | 855 |
["--key"], |
| 857 | 856 |
error_text="no keys suitable", |
| ... | ... |
@@ -866,13 +865,11 @@ class TestStoringConfigurationFailures: |
| 866 | 865 |
|
| 867 | 866 |
monkeypatch.setattr(ssh_agent.SSHAgentClient, "list_keys", func) |
| 868 | 867 |
|
| 869 |
- def test_store_config_fail_manual_ssh_agent_runtime_error(self) -> None: |
|
| 870 |
- """Triggering an error in the SSH agent during `--config --key` leads to failure. |
|
| 871 |
- |
|
| 872 |
- (This test does not actually need a running agent; the agent's |
|
| 873 |
- response is mocked by the test harness.) |
|
| 874 |
- |
|
| 875 |
- """ |
|
| 868 |
+ def test_store_config_fail_manual_ssh_agent_runtime_error( |
|
| 869 |
+ self, spawn_ssh_agent: data.SpawnedSSHAgentInfo |
|
| 870 |
+ ) -> None: |
|
| 871 |
+ """Triggering an error in the SSH agent during `--config --key` leads to failure.""" |
|
| 872 |
+ del spawn_ssh_agent |
|
| 876 | 873 |
with self._test( |
| 877 | 874 |
["--key"], |
| 878 | 875 |
error_text="violates the communication protocol", |
| ... | ... |
@@ -884,13 +881,11 @@ class TestStoringConfigurationFailures: |
| 884 | 881 |
|
| 885 | 882 |
monkeypatch.setattr(ssh_agent.SSHAgentClient, "list_keys", raiser) |
| 886 | 883 |
|
| 887 |
- def test_store_config_fail_manual_ssh_agent_refuses(self) -> None: |
|
| 888 |
- """The SSH agent refusing during `--config --key` leads to failure. |
|
| 889 |
- |
|
| 890 |
- (This test does not actually need a running agent; the agent's |
|
| 891 |
- response is mocked by the test harness.) |
|
| 892 |
- |
|
| 893 |
- """ |
|
| 884 |
+ def test_store_config_fail_manual_ssh_agent_refuses( |
|
| 885 |
+ self, spawn_ssh_agent: data.SpawnedSSHAgentInfo |
|
| 886 |
+ ) -> None: |
|
| 887 |
+ """The SSH agent refusing during `--config --key` leads to failure.""" |
|
| 888 |
+ del spawn_ssh_agent |
|
| 894 | 889 |
with self._test( |
| 895 | 890 |
["--key"], error_text="refused to", patch_suitable_ssh_keys=False |
| 896 | 891 |
) as monkeypatch: |
| 897 | 892 |