impure-tests: migrate bash to pytest and fix stuff

This commit is contained in:
DavHau
2023-09-22 18:32:09 +02:00
parent f6398c85bb
commit 9825c179a8
5 changed files with 57 additions and 76 deletions

View File

@@ -6,6 +6,8 @@ from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any
from clan_cli.nix import nix_shell
from ..dirs import get_clan_flake_toplevel
from ..errors import ClanError
from ..ssh import parse_deployment_address
@@ -47,7 +49,8 @@ secrets={shlex.quote(str(secrets_dir))}
{generator}
"""
try:
subprocess.run(["bash", "-c", text], check=True)
cmd = nix_shell(["bash"], ["bash", "-c", text])
subprocess.run(cmd, check=True)
except subprocess.CalledProcessError:
msg = "failed to the following command:\n"
msg += text