Marco Ricci commited on 2025-12-25 12:31:13
Zeige 3 geänderte Dateien mit 14 Einfügungen und 14 Löschungen.
All stubbed agents should either be named `stub_agent` or start with `stub_agent_`. Also, the test suite spawns the "stubbed agent with address and with deterministic DSA support" as "the more complicated stub agent", and the "stubbed agent with extensions" as "the plain stubbed agent". The parametrization keys however suggest otherwise, that the choice is between the "stubbed agent with extensions" and the "base stubbed agent". Fix the keys, and the returned `RunningSSHAgentInfo` structure. (The stubbed agent with extensions is the first agent to support specifying the address to connect to, which the test suite realistically needs to manipulate. The base stubbed agent *is* tested directly, however, for all functionality tests of the family of stubbed agents.)
| ... | ... |
@@ -805,8 +805,8 @@ SocketProvider.registry.update({
|
| 805 | 805 |
"ssh_auth_sock_on_the_annoying_os": SocketProvider.windows_named_pipe_ssh_auth_sock, # noqa: E501 |
| 806 | 806 |
# known instances |
| 807 | 807 |
"stub_agent": None, |
| 808 |
- "stub_with_address": None, |
|
| 809 |
- "stub_with_address_and_deterministic_dsa": None, |
|
| 808 |
+ "stub_agent_with_address": None, |
|
| 809 |
+ "stub_agent_with_address_and_deterministic_dsa": None, |
|
| 810 | 810 |
# aliases |
| 811 | 811 |
"posix": "ssh_auth_sock_on_posix", |
| 812 | 812 |
"ssh_auth_sock": "ssh_auth_sock_on_posix", |
| ... | ... |
@@ -306,13 +306,13 @@ spawn_handlers: dict[str, tuple[str, SpawnFunc, tests.data.KnownSSHAgent]] = {
|
| 306 | 306 |
spawn_openssh_agent_on_posix, |
| 307 | 307 |
tests.data.KnownSSHAgent.OpenSSHAgent, |
| 308 | 308 |
), |
| 309 |
- "stub_agent": ( |
|
| 310 |
- "stub_agent", |
|
| 309 |
+ "stub_agent_with_address": ( |
|
| 310 |
+ "stub_agent_with_address", |
|
| 311 | 311 |
spawn_noop, |
| 312 | 312 |
tests.data.KnownSSHAgent.StubbedSSHAgent, |
| 313 | 313 |
), |
| 314 |
- "stub_agent_with_extensions": ( |
|
| 315 |
- "stub_agent_with_extensions", |
|
| 314 |
+ "stub_agent_with_address_and_deterministic_dsa": ( |
|
| 315 |
+ "stub_agent_with_address_and_deterministic_dsa", |
|
| 316 | 316 |
spawn_noop, |
| 317 | 317 |
tests.data.KnownSSHAgent.StubbedSSHAgent, |
| 318 | 318 |
), |
| ... | ... |
@@ -454,14 +454,14 @@ def spawn_named_agent( |
| 454 | 454 |
monkeypatch.setattr( |
| 455 | 455 |
ssh_agent.SSHAgentClient, |
| 456 | 456 |
"SOCKET_PROVIDERS", |
| 457 |
- ["stub_with_address_and_deterministic_dsa"] |
|
| 458 |
- if exec_name == "stub_agent_with_extensions" |
|
| 459 |
- else ["stub_with_address"], |
|
| 457 |
+ ["stub_agent_with_address_and_deterministic_dsa"] |
|
| 458 |
+ if exec_name == "stub_agent_with_address_and_deterministic_dsa" |
|
| 459 |
+ else ["stub_agent_with_address"], |
|
| 460 | 460 |
) |
| 461 | 461 |
client = exit_stack.enter_context( |
| 462 | 462 |
ssh_agent.SSHAgentClient.ensure_agent_subcontext( |
| 463 | 463 |
tests.machinery.StubbedSSHAgentSocketWithAddressAndDeterministicDSA() |
| 464 |
- if exec_name == "stub_agent_with_extensions" |
|
| 464 |
+ if exec_name == "stub_agent_with_address_and_deterministic_dsa" |
|
| 465 | 465 |
else tests.machinery.StubbedSSHAgentSocketWithAddress() |
| 466 | 466 |
) |
| 467 | 467 |
) |
| ... | ... |
@@ -579,14 +579,14 @@ def running_ssh_agent( # pragma: no cover [external] |
| 579 | 579 |
monkeypatch.setattr( |
| 580 | 580 |
ssh_agent.SSHAgentClient, |
| 581 | 581 |
"SOCKET_PROVIDERS", |
| 582 |
- ["stub_with_address"], |
|
| 582 |
+ ["stub_agent_with_address"], |
|
| 583 | 583 |
) |
| 584 | 584 |
monkeypatch.setenv( |
| 585 | 585 |
"SSH_AUTH_SOCK", |
| 586 | 586 |
tests.machinery.StubbedSSHAgentSocketWithAddress.ADDRESS, |
| 587 | 587 |
) |
| 588 | 588 |
yield tests.data.RunningSSHAgentInfo( |
| 589 |
- tests.machinery.StubbedSSHAgentSocketWithAddress, |
|
| 589 |
+ tests.machinery.StubbedSSHAgentSocketWithAddressAndDeterministicDSA, |
|
| 590 | 590 |
tests.data.KnownSSHAgent.StubbedSSHAgent, |
| 591 | 591 |
) |
| 592 | 592 |
else: |
| ... | ... |
@@ -594,7 +594,7 @@ class StubbedSSHAgentSocket: |
| 594 | 594 |
# ---------------- |
| 595 | 595 |
|
| 596 | 596 |
|
| 597 |
-@socketprovider.SocketProvider.register("stub_with_address")
|
|
| 597 |
+@socketprovider.SocketProvider.register("stub_agent_with_address")
|
|
| 598 | 598 |
class StubbedSSHAgentSocketWithAddress(StubbedSSHAgentSocket): |
| 599 | 599 |
"""A [`StubbedSSHAgentSocket`][] requiring a specific address.""" |
| 600 | 600 |
|
| ... | ... |
@@ -640,7 +640,7 @@ class StubbedSSHAgentSocketWithAddress(StubbedSSHAgentSocket): |
| 640 | 640 |
|
| 641 | 641 |
|
| 642 | 642 |
@socketprovider.SocketProvider.register( |
| 643 |
- "stub_with_address_and_deterministic_dsa" |
|
| 643 |
+ "stub_agent_with_address_and_deterministic_dsa" |
|
| 644 | 644 |
) |
| 645 | 645 |
class StubbedSSHAgentSocketWithAddressAndDeterministicDSA( |
| 646 | 646 |
StubbedSSHAgentSocketWithAddress |
| 647 | 647 |