Added more deal tests
This commit is contained in:
@@ -2,12 +2,13 @@ import json
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
import deal
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from .dirs import nixpkgs_flake, nixpkgs_source
|
||||
|
||||
|
||||
@deal.raises(ClanError)
|
||||
def nix_command(flags: list[str]) -> list[str]:
|
||||
return ["nix", "--extra-experimental-features", "nix-command flakes"] + flags
|
||||
|
||||
@@ -24,7 +25,7 @@ def nix_flake_show(flake_url: str | Path) -> list[str]:
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
@deal.raises(ClanError)
|
||||
def nix_build(
|
||||
flags: list[str],
|
||||
) -> list[str]:
|
||||
@@ -40,7 +41,7 @@ def nix_build(
|
||||
+ flags
|
||||
)
|
||||
|
||||
|
||||
@deal.raises(ClanError)
|
||||
def nix_config() -> dict[str, Any]:
|
||||
cmd = nix_command(["show-config", "--json"])
|
||||
proc = subprocess.run(cmd, check=True, text=True, stdout=subprocess.PIPE)
|
||||
@@ -50,7 +51,7 @@ def nix_config() -> dict[str, Any]:
|
||||
config[key] = value["value"]
|
||||
return config
|
||||
|
||||
|
||||
@deal.raises(ClanError)
|
||||
def nix_eval(flags: list[str]) -> list[str]:
|
||||
default_flags = nix_command(
|
||||
[
|
||||
@@ -77,7 +78,7 @@ def nix_eval(flags: list[str]) -> list[str]:
|
||||
)
|
||||
return default_flags + flags
|
||||
|
||||
|
||||
@deal.raises(ClanError)
|
||||
def nix_shell(packages: list[str], cmd: list[str]) -> list[str]:
|
||||
# we cannot use nix-shell inside the nix sandbox
|
||||
# in our tests we just make sure we have all the packages
|
||||
|
||||
Reference in New Issue
Block a user