Riduce falsi positivi del watchdog
This commit is contained in:
@@ -24,3 +24,27 @@ def test_mark_ignored_removes_from_pending_queue(tmp_path: Path) -> None:
|
||||
registry.mark_ignored(path)
|
||||
|
||||
assert registry.pending_count() == 0
|
||||
|
||||
|
||||
def test_snapshot_change_detection(tmp_path: Path) -> None:
|
||||
registry = ChangeRegistry(tmp_path / "changes.sqlite")
|
||||
path = str(tmp_path / "image.jpg")
|
||||
|
||||
assert registry.has_snapshot_changed(path, 100, 123)
|
||||
|
||||
registry.update_snapshot(path, 100, 123)
|
||||
|
||||
assert not registry.has_snapshot_changed(path, 100, 123)
|
||||
assert registry.has_snapshot_changed(path, 101, 123)
|
||||
assert registry.has_snapshot_changed(path, 100, 124)
|
||||
|
||||
|
||||
def test_record_stores_snapshot_and_mtime(tmp_path: Path) -> None:
|
||||
registry = ChangeRegistry(tmp_path / "changes.sqlite")
|
||||
path = str(tmp_path / "image.jpg")
|
||||
|
||||
registry.record(ChangeEvent(path=path, event_type="modified", size=100, mtime_ns=123))
|
||||
|
||||
pending = registry.list_pending()
|
||||
assert pending == [ChangeEvent(path=path, event_type="modified", size=100, mtime_ns=123)]
|
||||
assert not registry.has_snapshot_changed(path, 100, 123)
|
||||
|
||||
Reference in New Issue
Block a user