Merge pull request 'add clan_flake fixture to setup a temporary clan' (#43) from cli-prep into main

This commit is contained in:
clan-bot
2023-07-28 10:55:19 +00:00
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")) sys.path.append(os.path.join(os.path.dirname(__file__), "helpers"))
pytest_plugins = ["temporary_dir"] pytest_plugins = ["temporary_dir", "clan_flake"]