Added new type FlakeName

This commit is contained in:
Qubasa
2023-10-14 15:17:58 +02:00
parent f976121fa6
commit ecdd4949b7
17 changed files with 98 additions and 72 deletions

View File

@@ -8,6 +8,7 @@ import pytest
from root import CLAN_CORE
from clan_cli.dirs import nixpkgs_source
from clan_cli.flakes.types import FlakeName
# substitutes string sin a file.
@@ -28,13 +29,13 @@ def substitute(
class TestFlake(NamedTuple):
name: str
name: FlakeName
path: Path
def create_flake(
monkeypatch: pytest.MonkeyPatch,
flake_name: str,
flake_name: FlakeName,
clan_core_flake: Path | None = None,
machines: list[str] = [],
remote: bool = False,
@@ -74,7 +75,7 @@ def create_flake(
@pytest.fixture
def test_flake(monkeypatch: pytest.MonkeyPatch) -> Iterator[TestFlake]:
yield from create_flake(monkeypatch, "test_flake")
yield from create_flake(monkeypatch, FlakeName("test_flake"))
@pytest.fixture
@@ -83,7 +84,7 @@ def test_flake_with_core(monkeypatch: pytest.MonkeyPatch) -> Iterator[TestFlake]
raise Exception(
"clan-core flake not found. This test requires the clan-core flake to be present"
)
yield from create_flake(monkeypatch, "test_flake_with_core", CLAN_CORE)
yield from create_flake(monkeypatch, FlakeName("test_flake_with_core"), CLAN_CORE)
@pytest.fixture
@@ -94,4 +95,6 @@ def test_flake_with_core_and_pass(
raise Exception(
"clan-core flake not found. This test requires the clan-core flake to be present"
)
yield from create_flake(monkeypatch, "test_flake_with_core_and_pass", CLAN_CORE)
yield from create_flake(
monkeypatch, FlakeName("test_flake_with_core_and_pass"), CLAN_CORE
)

View File

@@ -9,6 +9,8 @@ from fixtures_flakes import TestFlake, create_flake
from httpx import SyncByteStream
from root import CLAN_CORE
from clan_cli.flakes.types import FlakeName
if TYPE_CHECKING:
from age_keys import KeyPair
@@ -17,7 +19,7 @@ if TYPE_CHECKING:
def flake_with_vm_with_secrets(monkeypatch: pytest.MonkeyPatch) -> Iterator[TestFlake]:
yield from create_flake(
monkeypatch,
"test_flake_with_core_dynamic_machines",
FlakeName("test_flake_with_core_dynamic_machines"),
CLAN_CORE,
machines=["vm_with_secrets"],
)
@@ -29,7 +31,7 @@ def remote_flake_with_vm_without_secrets(
) -> Iterator[TestFlake]:
yield from create_flake(
monkeypatch,
"test_flake_with_core_dynamic_machines",
FlakeName("test_flake_with_core_dynamic_machines"),
CLAN_CORE,
machines=["vm_without_secrets"],
remote=True,