net-kingdom/local-identity/tests/conftest.py

20 lines
565 B
Python
Raw Normal View History

"""
Shared pytest fixtures for local-identity tests.
The LOCAL_IDENTITY_HOME env var redirects the store to a temp directory,
keeping tests isolated from the real ~/.local-identity store.
"""
import pytest
@pytest.fixture
def tmp_store(tmp_path, monkeypatch):
"""
Redirect the local-identity store to a fresh temp directory.
Returns the Path to the store root (not yet created call init_dirs() as needed).
"""
store_path = tmp_path / ".local-identity"
monkeypatch.setenv("LOCAL_IDENTITY_HOME", str(store_path))
return store_path