fix gpg key fixture on macOS

macOS has length limitations for unix sockets, which are violated by the
default length of temporary directories.
This commit is contained in:
Jörg Thalheim
2025-03-25 18:09:04 +01:00
parent 3c7991137a
commit 3a78dd6ded
3 changed files with 34 additions and 24 deletions

View File

@@ -0,0 +1,25 @@
import shutil
from dataclasses import dataclass
from pathlib import Path
import pytest
@dataclass
class GpgKey:
fingerprint: str
gpg_home: Path
@pytest.fixture
def gpg_key(
temp_dir: Path,
monkeypatch: pytest.MonkeyPatch,
test_root: Path,
) -> GpgKey:
gpg_home = temp_dir / "gnupghome"
shutil.copytree(test_root / "data" / "gnupg-home", gpg_home)
monkeypatch.setenv("GNUPGHOME", str(gpg_home))
return GpgKey("9A9B2741C8062D3D3DF1302D8B049E262A5CA255", gpg_home)