Marco Ricci
Remove debugging-only code and add missing docstring in pytest fixtures
Marco Ricci commited d01a4dc at 2024-09-22 19:19:38
# SPDX-FileCopyrightText: 2024 Marco Ricci <software@the13thletter.info>
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import base64
import contextlib
import operator
import os
import shutil
import subprocess
import sys
import textwrap
from typing import TYPE_CHECKING, TypeVar
import packaging.version
import pytest
import tests
from derivepassphrase import _types, ssh_agent
if TYPE_CHECKING:
from collections.abc import Iterator
from typing import Literal
startup_ssh_auth_sock = os.environ.get('SSH_AUTH_SOCK', None)
# https://docs.pytest.org/en/stable/explanation/fixtures.html#a-note-about-fixture-cleanup
# https://github.com/pytest-dev/pytest/issues/5243#issuecomment-491522595
@pytest.fixture(scope='session', autouse=True)
def term_handler() -> Iterator[None]: # pragma: no cover
try:
import signal # noqa: PLC0415
sigint_handler = signal.getsignal(signal.SIGINT)
except (ImportError, OSError):
return
else:
orig_term = signal.signal(signal.SIGTERM, sigint_handler)
yield
signal.signal(signal.SIGTERM, orig_term)
def _spawn_pageant( # pragma: no cover
executable: str | None, env: dict[str, str]
) -> tuple[subprocess.Popen[str], bool] | None:
"""Spawn an isolated Pageant, if possible.
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX