Private
Public Access
test(sandbox): update v3 paths-aware tests for FR1+FR3 invariants
- test_paths.py: explicit initialize_paths(<empty_config>) instead of
SLOP_CONFIG env var (v3 design); add restore_paths fixture so other
tests keep their conftest workspace init.
- test_summary_cache.py: use tmp_path (under ./tests/) instead of
hardcoded Path('.test_cache') that FR1 blocks.
- test_orchestrator_pm_history.py: use tempfile.mkdtemp() instead of
writing to project-root 'test_conductor/' that FR1 blocks.
- test_gui_paths.py::test_save_paths: mock src.paths.initialize_paths
instead of src.paths.reset_paths (v3 entry point).
All 12 tests pass in the Tier 2 clone after these fixes.
This commit is contained in:
@@ -9,11 +9,10 @@ def test_get_file_hash():
|
||||
expected = "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"
|
||||
assert get_file_hash(content) == expected
|
||||
|
||||
def test_summary_cache():
|
||||
cache_dir = Path(".test_cache")
|
||||
if cache_dir.exists():
|
||||
shutil.rmtree(cache_dir)
|
||||
cache_file = cache_dir / "cache.json"
|
||||
def test_summary_cache(tmp_path):
|
||||
# v3 paths.py: use tmp_path (which is under ./tests/) instead of
|
||||
# hardcoded project-root paths that the FR1 guard blocks.
|
||||
cache_file = tmp_path / "cache.json"
|
||||
|
||||
cache = SummaryCache(str(cache_file))
|
||||
|
||||
@@ -35,16 +34,11 @@ def test_summary_cache():
|
||||
# Test persistence
|
||||
cache2 = SummaryCache(str(cache_file))
|
||||
assert cache2.get_summary(file_path, content_hash) == summary
|
||||
|
||||
# Cleanup
|
||||
if cache_dir.exists():
|
||||
shutil.rmtree(cache_dir)
|
||||
|
||||
def test_summary_cache_lru():
|
||||
cache_dir = Path(".test_cache_lru")
|
||||
if cache_dir.exists():
|
||||
shutil.rmtree(cache_dir)
|
||||
cache_file = cache_dir / "cache.json"
|
||||
|
||||
def test_summary_cache_lru(tmp_path):
|
||||
# v3 paths.py: use tmp_path instead of hardcoded project-root paths.
|
||||
cache_file = tmp_path / "cache.json"
|
||||
|
||||
# Create cache with max 2 entries
|
||||
cache = SummaryCache(str(cache_file), max_entries=2)
|
||||
@@ -64,9 +58,6 @@ def test_summary_cache_lru():
|
||||
assert cache.get_summary("file3.py", "hash3") is None
|
||||
assert cache.get_summary("file2.py", "hash2") == "summary2"
|
||||
assert cache.get_summary("file4.py", "hash4") == "summary4"
|
||||
|
||||
if cache_dir.exists():
|
||||
shutil.rmtree(cache_dir)
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_get_file_hash()
|
||||
|
||||
Reference in New Issue
Block a user