style(test_sync): match CI ruff 0.4.x format
This commit is contained in:
+30
-30
@@ -441,9 +441,9 @@ class TestSyncPalace:
|
|||||||
# Allow-list — params must be exactly the documented audit shape so
|
# Allow-list — params must be exactly the documented audit shape so
|
||||||
# any future leak (source_file, content, ID lists, etc.) trips a
|
# any future leak (source_file, content, ID lists, etc.) trips a
|
||||||
# test failure rather than slipping through a deny-list.
|
# test failure rather than slipping through a deny-list.
|
||||||
assert set(params.keys()) <= {"first_id"}, (
|
assert set(params.keys()) <= {
|
||||||
f"WAL params drifted from the audit allow-list: {params.keys()}"
|
"first_id"
|
||||||
)
|
}, f"WAL params drifted from the audit allow-list: {params.keys()}"
|
||||||
|
|
||||||
def test_registry_sentinels_preserved_on_apply(self, tmp_dir, palace_path):
|
def test_registry_sentinels_preserved_on_apply(self, tmp_dir, palace_path):
|
||||||
"""F2 regression: convo miner `_reg_*` sentinels must survive sync apply.
|
"""F2 regression: convo miner `_reg_*` sentinels must survive sync apply.
|
||||||
@@ -564,9 +564,9 @@ class TestSyncPalace:
|
|||||||
inner_resolved = inner.resolve(strict=False)
|
inner_resolved = inner.resolve(strict=False)
|
||||||
outer_resolved = outer.resolve(strict=False)
|
outer_resolved = outer.resolve(strict=False)
|
||||||
assert inner_resolved in roots, f"expected inner in roots, got {roots}"
|
assert inner_resolved in roots, f"expected inner in roots, got {roots}"
|
||||||
assert outer_resolved not in roots, (
|
assert (
|
||||||
f"deepest should win exclusively: roots={roots}, outer leaked"
|
outer_resolved not in roots
|
||||||
)
|
), f"deepest should win exclusively: roots={roots}, outer leaked"
|
||||||
|
|
||||||
def test_apply_with_empty_project_dirs_raises(self, palace_path):
|
def test_apply_with_empty_project_dirs_raises(self, palace_path):
|
||||||
"""Round-2 P1: `project_dirs=[]` (empty list) with apply must raise,
|
"""Round-2 P1: `project_dirs=[]` (empty list) with apply must raise,
|
||||||
@@ -605,9 +605,9 @@ class TestSyncPalace:
|
|||||||
project_dirs=[synced_world["repo_path"]],
|
project_dirs=[synced_world["repo_path"]],
|
||||||
dry_run=False,
|
dry_run=False,
|
||||||
)
|
)
|
||||||
assert any("Closet purge skipped" in record.getMessage() for record in caplog.records), (
|
assert any(
|
||||||
f"expected closet-skip warning, got: {[r.getMessage() for r in caplog.records]}"
|
"Closet purge skipped" in record.getMessage() for record in caplog.records
|
||||||
)
|
), f"expected closet-skip warning, got: {[r.getMessage() for r in caplog.records]}"
|
||||||
|
|
||||||
def test_metadata_cache_cleared_on_exception(self, monkeypatch, config, synced_world, kg):
|
def test_metadata_cache_cleared_on_exception(self, monkeypatch, config, synced_world, kg):
|
||||||
"""F9 regression: tool_sync's try/finally must clear `_metadata_cache`
|
"""F9 regression: tool_sync's try/finally must clear `_metadata_cache`
|
||||||
@@ -648,9 +648,9 @@ class TestSyncPalace:
|
|||||||
assert result.get("success") is False
|
assert result.get("success") is False
|
||||||
assert "simulated" in result.get("error", "")
|
assert "simulated" in result.get("error", "")
|
||||||
|
|
||||||
assert mcp_server._metadata_cache is None, (
|
assert (
|
||||||
"F9: cache must be cleared even when sync_palace raises"
|
mcp_server._metadata_cache is None
|
||||||
)
|
), "F9: cache must be cleared even when sync_palace raises"
|
||||||
|
|
||||||
def test_sync_report_keys_stable(self, synced_world):
|
def test_sync_report_keys_stable(self, synced_world):
|
||||||
"""Regression: SyncReport schema must not silently drop a field."""
|
"""Regression: SyncReport schema must not silently drop a field."""
|
||||||
@@ -943,9 +943,9 @@ class TestSyncPalace:
|
|||||||
wing="demo",
|
wing="demo",
|
||||||
dry_run=True,
|
dry_run=True,
|
||||||
)
|
)
|
||||||
assert report["gitignored"] == 1, (
|
assert (
|
||||||
f"symmetric resolve broken: drawer mis-bucketed; report={report}"
|
report["gitignored"] == 1
|
||||||
)
|
), f"symmetric resolve broken: drawer mis-bucketed; report={report}"
|
||||||
assert report["out_of_scope"] == 0
|
assert report["out_of_scope"] == 0
|
||||||
|
|
||||||
def test_classification_cache_avoids_redundant_disk_hits(
|
def test_classification_cache_avoids_redundant_disk_hits(
|
||||||
@@ -1002,9 +1002,9 @@ class TestSyncPalace:
|
|||||||
)
|
)
|
||||||
assert report["scanned"] == 5
|
assert report["scanned"] == 5
|
||||||
assert report["gitignored"] == 5
|
assert report["gitignored"] == 5
|
||||||
assert call_count["n"] == 1, (
|
assert (
|
||||||
f"cache miss: expected 1 _classify_drawer call (4 cache hits), got {call_count['n']}"
|
call_count["n"] == 1
|
||||||
)
|
), f"cache miss: expected 1 _classify_drawer call (4 cache hits), got {call_count['n']}"
|
||||||
|
|
||||||
def test_closet_batch_purge_single_call(self, synced_world, monkeypatch):
|
def test_closet_batch_purge_single_call(self, synced_world, monkeypatch):
|
||||||
"""Batched $in closet purge: one delete() call across all removable
|
"""Batched $in closet purge: one delete() call across all removable
|
||||||
@@ -1071,16 +1071,16 @@ class TestSyncPalace:
|
|||||||
str(repo_path / "deleted.py"),
|
str(repo_path / "deleted.py"),
|
||||||
}
|
}
|
||||||
expected = len(seeded_sources & set(report["by_source"].keys()))
|
expected = len(seeded_sources & set(report["by_source"].keys()))
|
||||||
assert report["removed_closets"] == expected, (
|
assert (
|
||||||
f"removed_closets ({report['removed_closets']}) != |seeded ∩ removable| ({expected})"
|
report["removed_closets"] == expected
|
||||||
)
|
), f"removed_closets ({report['removed_closets']}) != |seeded ∩ removable| ({expected})"
|
||||||
assert "wrapper" in captured, "get_closets_collection patch not invoked"
|
assert "wrapper" in captured, "get_closets_collection patch not invoked"
|
||||||
assert captured["wrapper"].delete_calls == 1, (
|
assert (
|
||||||
f"expected one batch delete call, got {captured['wrapper'].delete_calls}"
|
captured["wrapper"].delete_calls == 1
|
||||||
)
|
), f"expected one batch delete call, got {captured['wrapper'].delete_calls}"
|
||||||
assert captured["wrapper"].get_calls == 1, (
|
assert (
|
||||||
f"expected one batch get call, got {captured['wrapper'].get_calls}"
|
captured["wrapper"].get_calls == 1
|
||||||
)
|
), f"expected one batch get call, got {captured['wrapper'].get_calls}"
|
||||||
|
|
||||||
def test_registry_check_runs_before_cache_lookup(self, tmp_dir, palace_path):
|
def test_registry_check_runs_before_cache_lookup(self, tmp_dir, palace_path):
|
||||||
"""A non-registry drawer with the same source_file must NOT poison
|
"""A non-registry drawer with the same source_file must NOT poison
|
||||||
@@ -1145,9 +1145,9 @@ class TestSyncPalace:
|
|||||||
finally:
|
finally:
|
||||||
del client
|
del client
|
||||||
assert "a_regular" not in survivors
|
assert "a_regular" not in survivors
|
||||||
assert "_reg_zzz_sentinel" in survivors, (
|
assert (
|
||||||
"registry sentinel was incorrectly pruned via cached non-registry verdict"
|
"_reg_zzz_sentinel" in survivors
|
||||||
)
|
), "registry sentinel was incorrectly pruned via cached non-registry verdict"
|
||||||
|
|
||||||
def test_normalize_project_dirs_sort_stable_on_equal_length(self):
|
def test_normalize_project_dirs_sort_stable_on_equal_length(self):
|
||||||
"""`_normalize_project_dirs` must sort by `(-len, str)` so equal-length
|
"""`_normalize_project_dirs` must sort by `(-len, str)` so equal-length
|
||||||
|
|||||||
Reference in New Issue
Block a user