aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests/test_indexer_silent_disk.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-node/tests/test_indexer_silent_disk.py')
-rw-r--r--packages/meshbay-node/tests/test_indexer_silent_disk.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/packages/meshbay-node/tests/test_indexer_silent_disk.py b/packages/meshbay-node/tests/test_indexer_silent_disk.py
index bb618fc..4073ac5 100644
--- a/packages/meshbay-node/tests/test_indexer_silent_disk.py
+++ b/packages/meshbay-node/tests/test_indexer_silent_disk.py
@@ -133,14 +133,14 @@ async def test_a_file_the_system_refuses_is_listed_with_what_it_said(
tmp_path, monkeypatch):
films = _folder(tmp_path, "Films", ["a.mkv", "locked.mkv"])
idx = _indexer(RootSet.build([{"path": str(films)}]))
- real = indexer_mod.long_path
- def refuse(path):
+ def refuse(path, *args, **kw):
+ # What a locked file does: it lists and stats, and refuses to open.
if Path(path).name == "locked.mkv":
raise PermissionError(13, "Permission denied")
- return real(path)
+ return open(path, *args, **kw)
- monkeypatch.setattr(indexer_mod, "long_path", refuse)
+ monkeypatch.setattr(indexer_mod, "open", refuse, raising=False)
await idx.initial_scan()
assert _names(idx) == {"a.mkv"}
@@ -149,7 +149,7 @@ async def test_a_file_the_system_refuses_is_listed_with_what_it_said(
# A refusal costs nothing to ask again, and permissions change without the
# file changing: it is not remembered the way a silence is.
- monkeypatch.setattr(indexer_mod, "long_path", real)
+ monkeypatch.delattr(indexer_mod, "open")
await idx.reconcile()
assert "locked.mkv" in _names(idx)
assert idx.unread == {}