Browse Source

Minor comments

pull/2/head
Ryan Reed 2 years ago
parent
commit
87ce51aef2
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      tests/test_project.py

+ 3
- 0
tests/test_project.py View File

@ -161,16 +161,19 @@ def test_transpose_store_restore():
def test_transpose_restore_force(): def test_transpose_restore_force():
nonexistent_path = Path(STORE_DIR).joinpath("long/path") nonexistent_path = Path(STORE_DIR).joinpath("long/path")
# Overwrite cache file with nonexistent directory
cache_path = Path(TARGET_DIR).joinpath(DEFAULT_CACHE_FILENAME) cache_path = Path(TARGET_DIR).joinpath(DEFAULT_CACHE_FILENAME)
cache = {"version": version, "original_path": str(nonexistent_path)} cache = {"version": version, "original_path": str(nonexistent_path)}
with open(str(cache_path), "w") as f: with open(str(cache_path), "w") as f:
json.dump(cache, f) json.dump(cache, f)
# Force not enabled, should raise exception
t = Transpose(target_path=TARGET_DIR, store_path=STORE_DIR) t = Transpose(target_path=TARGET_DIR, store_path=STORE_DIR)
with pytest.raises(TransposeError): with pytest.raises(TransposeError):
t.restore() t.restore()
assert not nonexistent_path.exists() assert not nonexistent_path.exists()
# Force enabled, should create directory tree
t = Transpose(target_path=TARGET_DIR, store_path=STORE_DIR, force=True) t = Transpose(target_path=TARGET_DIR, store_path=STORE_DIR, force=True)
t.restore() t.restore()
assert nonexistent_path.exists() assert nonexistent_path.exists()

Loading…
Cancel
Save