nixosTestLib: fix various linting issues
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""SSH and test setup utilities"""
|
||||
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from typing import NamedTuple
|
||||
|
||||
from .nix_setup import setup_nix_in_nix
|
||||
@@ -34,15 +35,14 @@ def setup_test_environment(
|
||||
|
||||
setup_port_forwarding(target, host_port)
|
||||
|
||||
ssh_key = os.path.join(temp_dir, "id_ed25519")
|
||||
with open(ssh_key, "w") as f:
|
||||
with open(assets_ssh_privkey) as src:
|
||||
f.write(src.read())
|
||||
os.chmod(ssh_key, 0o600)
|
||||
ssh_key = Path(temp_dir) / "id_ed25519"
|
||||
with ssh_key.open("w") as f, Path(assets_ssh_privkey).open() as src:
|
||||
f.write(src.read())
|
||||
ssh_key.chmod(0o600)
|
||||
|
||||
# Copy test flake to temp directory
|
||||
flake_dir = os.path.join(temp_dir, "test-flake")
|
||||
subprocess.run(["cp", "-r", clan_core_for_checks, flake_dir], check=True)
|
||||
subprocess.run(["chmod", "-R", "+w", flake_dir], check=True)
|
||||
flake_dir = Path(temp_dir) / "test-flake"
|
||||
subprocess.run(["cp", "-r", clan_core_for_checks, flake_dir], check=True) # noqa: S603, S607
|
||||
subprocess.run(["chmod", "-R", "+w", flake_dir], check=True) # noqa: S603, S607
|
||||
|
||||
return TestEnvironment(host_port, ssh_key, flake_dir)
|
||||
return TestEnvironment(host_port, str(ssh_key), str(flake_dir))
|
||||
|
||||
Reference in New Issue
Block a user