from __future__ import annotations
import base64
import contextlib
import operator
import os
import shutil
import socket
import subprocess
from typing import TYPE_CHECKING, TypeVar
import hypothesis
import packaging.version
import pytest
import tests
from derivepassphrase import _types, ssh_agent
if TYPE_CHECKING:
from collections.abc import Iterator
startup_ssh_auth_sock = os.environ.get('SSH_AUTH_SOCK', None)
hypothesis.settings.register_profile('ci', max_examples=1000)
hypothesis.settings.register_profile('dev', max_examples=10)
hypothesis.settings.register_profile(
'debug', max_examples=10, verbosity=hypothesis.Verbosity.verbose
)
@pytest.fixture(scope='session', autouse=True)
def term_handler() -> Iterator[None]:
try:
import signal
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)