56 lines
1.8 KiB
Python
56 lines
1.8 KiB
Python
import os
|
|
import pytest
|
|
import tomllib
|
|
import tomli_w
|
|
from pathlib import Path
|
|
from src import paths
|
|
|
|
def test_get_conductor_dir_default():
|
|
paths.reset_resolved()
|
|
# Should return default "conductor" relative to root
|
|
expected = Path(__file__).resolve().parent.parent / "conductor"
|
|
assert paths.get_conductor_dir() == expected
|
|
|
|
def test_get_conductor_dir_project_specific_no_toml(tmp_path):
|
|
paths.reset_resolved()
|
|
project_root = tmp_path / "my_project"
|
|
project_root.mkdir()
|
|
|
|
# Should default to project_root / "conductor" if no manual_slop.toml
|
|
res = paths.get_conductor_dir(project_path=str(project_root))
|
|
assert res == project_root / "conductor"
|
|
|
|
def test_get_conductor_dir_project_specific_with_toml(tmp_path):
|
|
paths.reset_resolved()
|
|
project_root = tmp_path / "my_project"
|
|
project_root.mkdir()
|
|
|
|
# Create manual_slop.toml with custom conductor dir
|
|
toml_path = project_root / "manual_slop.toml"
|
|
config = {
|
|
"conductor": {
|
|
"dir": "custom_tracks"
|
|
}
|
|
}
|
|
with open(toml_path, "wb") as f:
|
|
f.write(tomli_w.dumps(config).encode())
|
|
|
|
res = paths.get_conductor_dir(project_path=str(project_root))
|
|
assert res == project_root / "custom_tracks"
|
|
|
|
def test_get_tracks_dir_project_specific(tmp_path):
|
|
paths.reset_resolved()
|
|
project_root = tmp_path / "my_project"
|
|
project_root.mkdir()
|
|
|
|
res = paths.get_tracks_dir(project_path=str(project_root))
|
|
assert res == project_root / "conductor" / "tracks"
|
|
|
|
def test_get_track_state_dir_project_specific(tmp_path):
|
|
paths.reset_resolved()
|
|
project_root = tmp_path / "my_project"
|
|
project_root.mkdir()
|
|
|
|
res = paths.get_track_state_dir("track-123", project_path=str(project_root))
|
|
assert res == project_root / "conductor" / "tracks" / "track-123"
|