def test_open_local(): d1 = str(tempfile.mkdtemp()) f1 = os.path.join(d1, "f1") open(f1, "w").write("test1") d2 = str(tempfile.mkdtemp()) fn = open_local("simplecache://" + f1, cache_storage=d2, target_protocol="file") assert isinstance(fn, str) assert open(fn).read() == "test1" assert d2 in fn
def test_not_local(): with pytest.raises(ValueError, match="attribute local_file=True"): open_local("memory://afile")