Merge pull request 'use experimental flags everywhere' (#298) from Mic92-vm-api into main
This commit is contained in:
@@ -4,12 +4,13 @@ import pytest
|
||||
|
||||
TEST_ROOT = Path(__file__).parent.resolve()
|
||||
PROJECT_ROOT = TEST_ROOT.parent
|
||||
CLAN_CORE = PROJECT_ROOT.parent.parent
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def project_root() -> Path:
|
||||
"""
|
||||
Root directory of the tests
|
||||
Root directory the clan-cli
|
||||
"""
|
||||
return PROJECT_ROOT
|
||||
|
||||
@@ -20,3 +21,11 @@ def test_root() -> Path:
|
||||
Root directory of the tests
|
||||
"""
|
||||
return TEST_ROOT
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def clan_core() -> Path:
|
||||
"""
|
||||
Directory of the clan-core flake
|
||||
"""
|
||||
return CLAN_CORE
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
from typing import Union
|
||||
|
||||
import pytest_subprocess.fake_process
|
||||
from cli import Cli
|
||||
from pytest_subprocess import utils
|
||||
|
||||
|
||||
# using fp fixture from pytest-subprocess
|
||||
def test_create(fp: pytest_subprocess.fake_process.FakeProcess) -> None:
|
||||
cmd: list[Union[str, utils.Any]] = ["nix", "flake", "init", "-t", fp.any()]
|
||||
fp.register(cmd)
|
||||
cli = Cli()
|
||||
cli.run(["admin", "--folder", "./my-clan", "create"])
|
||||
assert fp.call_count(cmd) == 1
|
||||
12
pkgs/clan-cli/tests/test_clan_template.py
Normal file
12
pkgs/clan-cli/tests/test_clan_template.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from cli import Cli
|
||||
|
||||
|
||||
@pytest.mark.impure
|
||||
def test_template(monkeypatch: pytest.MonkeyPatch, temporary_dir: Path) -> None:
|
||||
monkeypatch.chdir(temporary_dir)
|
||||
cli = Cli()
|
||||
cli.run(["create"])
|
||||
assert (temporary_dir / ".clan-flake").exists()
|
||||
@@ -5,7 +5,7 @@ from pathlib import Path
|
||||
from typing import Iterator
|
||||
|
||||
import pytest
|
||||
from root import PROJECT_ROOT
|
||||
from root import CLAN_CORE
|
||||
|
||||
from clan_cli.dirs import nixpkgs_source
|
||||
|
||||
@@ -46,9 +46,8 @@ def test_flake(monkeymodule: pytest.MonkeyPatch) -> Iterator[Path]:
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def test_flake_with_core(monkeymodule: pytest.MonkeyPatch) -> Iterator[Path]:
|
||||
clan_core_flake = PROJECT_ROOT.parent.parent
|
||||
if not (clan_core_flake / "flake.nix").exists():
|
||||
if not (CLAN_CORE / "flake.nix").exists():
|
||||
raise Exception(
|
||||
"clan-core flake not found. This test requires the clan-core flake to be present"
|
||||
)
|
||||
yield from create_flake(monkeymodule, "test_flake_with_core", clan_core_flake)
|
||||
yield from create_flake(monkeymodule, "test_flake_with_core", CLAN_CORE)
|
||||
|
||||
@@ -30,9 +30,8 @@ def test_ssh_no_pass(
|
||||
monkeypatch.delenv("IN_NIX_SANDBOX")
|
||||
cmd: list[Union[str, utils.Any]] = [
|
||||
"nix",
|
||||
fp.any(),
|
||||
"shell",
|
||||
"--extra-experimental-features",
|
||||
"nix-command flakes",
|
||||
fp.any(),
|
||||
"-c",
|
||||
"torify",
|
||||
@@ -61,9 +60,8 @@ def test_ssh_with_pass(
|
||||
monkeypatch.delenv("IN_NIX_SANDBOX")
|
||||
cmd: list[Union[str, utils.Any]] = [
|
||||
"nix",
|
||||
fp.any(),
|
||||
"shell",
|
||||
"--extra-experimental-features",
|
||||
"nix-command flakes",
|
||||
fp.any(),
|
||||
"-c",
|
||||
"torify",
|
||||
|
||||
Reference in New Issue
Block a user