32 lines
1.3 KiB
Python
32 lines
1.3 KiB
Python
"""Tests for the live_gui_workspace fixture (Phase 3, Task 3.2)."""
|
|
from pathlib import Path
|
|
|
|
|
|
def test_live_gui_workspace_is_path(live_gui_workspace) -> None:
|
|
"""The live_gui_workspace fixture yields a Path object."""
|
|
assert isinstance(live_gui_workspace, Path)
|
|
|
|
|
|
def test_live_gui_workspace_exists(live_gui_workspace) -> None:
|
|
"""The workspace path was created and exists on disk."""
|
|
assert live_gui_workspace.exists()
|
|
|
|
|
|
def test_live_gui_workspace_is_a_directory(live_gui_workspace) -> None:
|
|
"""The workspace is a directory (not a file)."""
|
|
assert live_gui_workspace.is_dir()
|
|
|
|
|
|
def test_live_gui_workspace_in_tests_artifacts(live_gui_workspace) -> None:
|
|
"""The workspace is under tests/artifacts/ (per-run timestamped folder), NOT in the system temp dir."""
|
|
path_str = str(live_gui_workspace).replace("\\", "/")
|
|
assert "tests/artifacts/live_gui_workspace_" in path_str, f"Workspace not in tests/artifacts/: {live_gui_workspace}"
|
|
assert "temp" not in path_str.lower() and "tmp" not in path_str.lower(), f"Workspace should NOT be in tmp dir: {live_gui_workspace}"
|
|
|
|
|
|
def test_live_gui_workspace_writable(live_gui_workspace) -> None:
|
|
"""Tests can write to the workspace."""
|
|
test_file = live_gui_workspace / "test_write.txt"
|
|
test_file.write_text("hello", encoding="utf-8")
|
|
assert test_file.read_text(encoding="utf-8") == "hello"
|