From 5ff5b46896afdc070866288eaae61d08c6ae26d2 Mon Sep 17 00:00:00 2001 From: Qubasa Date: Wed, 5 Jun 2024 13:34:17 +0200 Subject: [PATCH] clan-cli: temporary_home, set XDG_RUNTIME_DIR --- pkgs/clan-cli/tests/temporary_dir.py | 8 ++++++++ pkgs/clan-cli/tests/test_secrets_password_store.py | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/clan-cli/tests/temporary_dir.py b/pkgs/clan-cli/tests/temporary_dir.py index 9da8d311..bdbb0b97 100644 --- a/pkgs/clan-cli/tests/temporary_dir.py +++ b/pkgs/clan-cli/tests/temporary_dir.py @@ -17,12 +17,20 @@ def temporary_home(monkeypatch: pytest.MonkeyPatch) -> Iterator[Path]: log.debug("Temp HOME directory: %s", str(path)) monkeypatch.setenv("HOME", str(path)) monkeypatch.setenv("XDG_CONFIG_HOME", str(path / ".config")) + runtime_dir = path / "xdg-runtime-dir" + runtime_dir.mkdir() + runtime_dir.chmod(0o700) + monkeypatch.setenv("XDG_RUNTIME_DIR", str(runtime_dir)) monkeypatch.chdir(str(path)) yield path else: with tempfile.TemporaryDirectory(prefix="pytest-") as dirpath: monkeypatch.setenv("HOME", str(dirpath)) monkeypatch.setenv("XDG_CONFIG_HOME", str(Path(dirpath) / ".config")) + runtime_dir = Path(dirpath) / "xdg-runtime-dir" + runtime_dir.mkdir() + runtime_dir.chmod(0o700) + monkeypatch.setenv("XDG_RUNTIME_DIR", str(runtime_dir)) monkeypatch.chdir(str(dirpath)) log.debug("Temp HOME directory: %s", str(dirpath)) yield Path(dirpath) diff --git a/pkgs/clan-cli/tests/test_secrets_password_store.py b/pkgs/clan-cli/tests/test_secrets_password_store.py index d028e25b..b59c278d 100644 --- a/pkgs/clan-cli/tests/test_secrets_password_store.py +++ b/pkgs/clan-cli/tests/test_secrets_password_store.py @@ -56,7 +56,6 @@ def test_upload_secret( # test idempotency cli.run(["facts", "generate", "vm1"]) assert identity_secret.lstat().st_mtime_ns == secret1_mtime - flake = test_flake_with_core_and_pass.path.joinpath("flake.nix") host = host_group.hosts[0] addr = f"{host.user}@{host.host}:{host.port}?StrictHostKeyChecking=no&UserKnownHostsFile=/dev/null&IdentityFile={host.key}"