add clan_flake fixture to setup a temporary clan

This commit is contained in:
Jörg Thalheim
2023-07-28 12:48:59 +02:00
parent 88a2c2656a
commit 29c711db30
2 changed files with 18 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
from pathlib import Path
from typing import Iterator
import pytest
from environment import mock_env
@pytest.fixture
def clan_flake(
temporary_directory: Path, monkeypatch: pytest.MonkeyPatch
) -> Iterator[Path]:
flake = temporary_directory / "clan-flake"
flake.mkdir()
(flake / ".clan-flake").touch()
monkeypatch.chdir(flake)
with mock_env(HOME=str(temporary_directory)):
yield temporary_directory

View File

@@ -3,4 +3,4 @@ import sys
sys.path.append(os.path.join(os.path.dirname(__file__), "helpers"))
pytest_plugins = ["temporary_dir"]
pytest_plugins = ["temporary_dir", "clan_flake"]