Skip to content

Commit

Permalink
Fix test_metadata_save_blocked
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthomas23 committed Aug 18, 2023
1 parent 48914e4 commit 544006f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fsspec/implementations/tests/test_cached.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,14 +537,15 @@ def open_raise(*_, **__):
raise NameError

try:

# To simulate an interpreter shutdown we temporarily set an open function in the
# cache_metadata module which is used on the next attempt to save metadata.
with caplog.at_level(logging.DEBUG):
with fs.open("/one", block_size=20) as f:
fsspec.implementations.cached.open = open_raise
fsspec.implementations.cache_metadata.open = open_raise
f.seek(21)
assert f.read(1)
finally:
fsspec.implementations.cached.__dict__.pop("open", None)
fsspec.implementations.cache_metadata.__dict__.pop("open", None)
assert "Cache save failed due to interpreter shutdown" in caplog.text


Expand Down

0 comments on commit 544006f

Please sign in to comment.