fieldwitness/tests/conftest.py
Aaron D. Lee 17147856d1
Some checks failed
CI / lint (push) Successful in 46s
CI / typecheck (push) Failing after 22s
CI / test (push) Failing after 20s
Fix all 98 ruff lint errors across codebase
- Remove unused imports (app.py, stego_routes.py, killswitch.py, etc.)
- Sort import blocks (I001)
- Add missing os import in stego_routes.py (F821)
- Rename shadowed Click commands to avoid F811 (status→chain_status, show→chain_show)
- Rename uppercase locals R→earth_r, _HAS_QRCODE_READ→_has_qrcode_read (N806)
- Suppress false-positive F821 for get_username (closure scope)
- Use datetime.UTC alias (UP017)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 18:30:01 -04:00

37 lines
1006 B
Python

"""Shared test fixtures for SooSeF tests."""
from __future__ import annotations
from pathlib import Path
import pytest
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
@pytest.fixture()
def tmp_soosef_dir(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
"""Set SOOSEF_DATA_DIR to a temporary directory.
This must be used before importing any module that reads soosef.paths
at import time. For modules that read paths lazily (most of them),
monkeypatching the paths module directly is more reliable.
"""
data_dir = tmp_path / ".soosef"
data_dir.mkdir()
monkeypatch.setenv("SOOSEF_DATA_DIR", str(data_dir))
return data_dir
@pytest.fixture()
def chain_dir(tmp_path: Path) -> Path:
"""A temporary chain directory."""
d = tmp_path / "chain"
d.mkdir()
return d
@pytest.fixture()
def private_key() -> Ed25519PrivateKey:
"""A fresh Ed25519 private key for testing."""
return Ed25519PrivateKey.generate()