Marco Ricci commited on 2026-06-16 19:47:25
Zeige 1 geänderte Dateien mit 29 Einfügungen und 10 Löschungen.
| ... | ... |
@@ -336,6 +336,9 @@ def interface_openssh_agent_on_the_annoying_os( |
| 336 | 336 |
class SpawnHandler(NamedTuple): |
| 337 | 337 |
"""A handler for a spawned or interfaced SSH agent. |
| 338 | 338 |
|
| 339 |
+ (The choice of terminology "spawn" instead of the more accurate |
|
| 340 |
+ "spawn or interface" is due to historical reasons.) |
|
| 341 |
+ |
|
| 339 | 342 |
Attributes: |
| 340 | 343 |
instance: |
| 341 | 344 |
The SSH agent instance type under which this handler is |
| ... | ... |
@@ -405,7 +408,10 @@ spawn_handlers: dict[str, SpawnHandler] = {
|
| 405 | 408 |
), |
| 406 | 409 |
} |
| 407 | 410 |
""" |
| 408 |
-The standard registry of agent spawning functions. |
|
| 411 |
+The standard registry of agent spawning/interfacing functions. |
|
| 412 |
+ |
|
| 413 |
+(The choice of terminology "spawn" instead of the more accurate "spawn |
|
| 414 |
+or interface" is due to historical reasons.) |
|
| 409 | 415 |
""" |
| 410 | 416 |
|
| 411 | 417 |
|
| ... | ... |
@@ -514,6 +520,9 @@ spawn_handlers_params: list[Sequence] = [] |
| 514 | 520 |
The standard registry of agent spawning functions, annotated as |
| 515 | 521 |
a `pytest` parameter set. (In particular, this includes the conditional |
| 516 | 522 |
skip marks.) Used by some test fixtures. |
| 523 |
+ |
|
| 524 |
+(The choice of terminology "spawn" instead of the more accurate "spawn |
|
| 525 |
+or interface" is due to historical reasons.) |
|
| 517 | 526 |
""" |
| 518 | 527 |
for instance, handler in spawn_handlers.items(): |
| 519 | 528 |
marks = [ |
| ... | ... |
@@ -614,6 +623,9 @@ def spawn_named_agent( # noqa: C901 |
| 614 | 623 |
channel are parsed with [`callables.parse_sh_export_line`][]. See |
| 615 | 624 |
the caveats there. |
| 616 | 625 |
|
| 626 |
+ (The choice of terminology "spawned" instead of the more accurate |
|
| 627 |
+ "spawned or interfaced" is due to historical reasons.) |
|
| 628 |
+ |
|
| 617 | 629 |
Args: |
| 618 | 630 |
executable: |
| 619 | 631 |
The full path of the executable to spawn. If not given, we |
| ... | ... |
@@ -783,9 +795,10 @@ def running_ssh_agent( # pragma: no cover [external] |
| 783 | 795 |
) -> Iterator[data.RunningSSHAgentInfo]: |
| 784 | 796 |
"""Ensure a running SSH agent, if possible, as a pytest fixture. |
| 785 | 797 |
|
| 786 |
- Check for a running SSH agent, or spawn a new one if possible. We |
|
| 787 |
- know how to spawn OpenSSH's agent and PuTTY's Pageant. If spawned |
|
| 788 |
- this way, the agent does not persist beyond the test. |
|
| 798 |
+ Check for a running SSH agent, or spawn/interface a new one if |
|
| 799 |
+ possible. We know how to spawn OpenSSH's agent and PuTTY's Pageant |
|
| 800 |
+ on UNIX, or interface them on The Annoying OS. If spawned this way, |
|
| 801 |
+ the agent does not persist beyond the test. |
|
| 789 | 802 |
|
| 790 | 803 |
This fixture can neither guarantee a particular running agent, nor |
| 791 | 804 |
can it guarantee a particular set of loaded keys. |
| ... | ... |
@@ -862,12 +875,17 @@ def running_ssh_agent( # pragma: no cover [external] |
| 862 | 875 |
def spawn_ssh_agent( |
| 863 | 876 |
request: pytest.FixtureRequest, |
| 864 | 877 |
) -> Iterator[data.SpawnedSSHAgentInfo]: # pragma: no cover [external] |
| 865 |
- """Spawn an isolated SSH agent, if possible, as a pytest fixture. |
|
| 878 |
+ """Spawn or interface an SSH agent, as a pytest fixture. |
|
| 879 |
+ |
|
| 880 |
+ Spawn a new SSH agent (isolated from other SSH use by other |
|
| 881 |
+ processes, on a best-effort basis), or interface a running |
|
| 882 |
+ (non-isolated) SSH agent. We know how to spawn OpenSSH's agent (on |
|
| 883 |
+ UNIX) and PuTTY's Pageant (on UNIX) and the stubbed agents, and how |
|
| 884 |
+ to interface PuTTY's Pageant (on The Annoying OS), OpenSSH's agent |
|
| 885 |
+ (on The Annoying OS) and the "system" agent (on every OS). |
|
| 866 | 886 |
|
| 867 |
- Spawn a new SSH agent isolated from other SSH use by other |
|
| 868 |
- processes, if possible. We know how to spawn OpenSSH's agent (on |
|
| 869 |
- UNIX) and PuTTY's Pageant (on UNIX), the stubbed agents, and the |
|
| 870 |
- "(system)" fallback agent. |
|
| 887 |
+ (The choice of terminology "spawned" instead of the more accurate |
|
| 888 |
+ "spawned or interfaced" is due to historical reasons.) |
|
| 871 | 889 |
|
| 872 | 890 |
Yields: |
| 873 | 891 |
A [named tuple][collections.namedtuple] containing information |
| ... | ... |
@@ -877,7 +895,8 @@ def spawn_ssh_agent( |
| 877 | 895 |
|
| 878 | 896 |
Raises: |
| 879 | 897 |
pytest.skip.Exception: |
| 880 |
- If the agent cannot be spawned, skip this test. |
|
| 898 |
+ If the agent cannot be spawned or interfaced, skip this |
|
| 899 |
+ test. |
|
| 881 | 900 |
|
| 882 | 901 |
""" |
| 883 | 902 |
|
| 884 | 903 |