Added state directory.

This commit is contained in:
Qubasa
2023-10-13 19:56:10 +02:00
parent 58b54bb9df
commit 2ad87785c0
10 changed files with 74 additions and 35 deletions

View File

@@ -1,3 +1,4 @@
import os
import tempfile
from pathlib import Path
from typing import Iterator
@@ -7,5 +8,11 @@ import pytest
@pytest.fixture
def temporary_dir() -> Iterator[Path]:
with tempfile.TemporaryDirectory(prefix="pytest-") as dirpath:
yield Path(dirpath)
if os.getenv("TEST_KEEP_TEMPORARY_DIR"):
temp_dir = tempfile.mkdtemp(prefix="pytest-")
path = Path(temp_dir)
yield path
print("=========> Keeping temporary directory: ", path)
else:
with tempfile.TemporaryDirectory(prefix="pytest-") as dirpath:
yield Path(dirpath)

View File

@@ -74,8 +74,9 @@ def generic_create_vm_test(api: TestClient, flake: Path, vm: str) -> None:
print(line.decode("utf-8"))
print("=========END LOGS==========")
assert response.status_code == 200, "Failed to get vm logs"
print("Get /api/vms/{uuid}/status")
response = api.get(f"/api/vms/{uuid}/status")
print("Finished Get /api/vms/{uuid}/status")
assert response.status_code == 200, "Failed to get vm status"
data = response.json()
assert (