clan-core/pkgs/clan-cli/tests/test_dirs.py
Jörg Thalheim 88a2c2656a
All checks were successful
build / test (push) Successful in 12s
get_clan_flake_toplevel: fix check
2023-07-28 12:36:01 +02:00

23 lines
602 B
Python

from pathlib import Path
import pytest
from clan_cli.dirs import get_clan_flake_toplevel
from clan_cli.errors import ClanError
def test_get_clan_flake_toplevel(
monkeypatch: pytest.MonkeyPatch, temporary_dir: Path
) -> None:
monkeypatch.chdir(temporary_dir)
with pytest.raises(ClanError):
get_clan_flake_toplevel()
(temporary_dir / ".git").touch()
assert get_clan_flake_toplevel() == temporary_dir
subdir = temporary_dir / "subdir"
subdir.mkdir()
monkeypatch.chdir(subdir)
(subdir / ".clan-flake").touch()
assert get_clan_flake_toplevel() == subdir