Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/borgstore/backends/posixfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class PosixFS(BackendBase):
def __init__(self, path, *, do_fsync=False, permissions=None):
self.base_path = Path(path)
if not self.base_path.is_absolute():
raise BackendError("path must be an absolute path")
raise BackendError(f"path must be an absolute path: {path}")
self.opened = False
self.do_fsync = do_fsync # False = 26x faster, see #10
self.permissions = permissions or {} # name [str] -> granted_permissions [str]
Expand Down
10 changes: 7 additions & 3 deletions tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def check_rclone_available():
be.destroy()
return True


def get_s3_test_backend():
# export BORGSTORE_TEST_S3_URL="s3:[profile|(access_key_id:access_key_secret)@][schema://hostname[:port]]/bucket/path"
# export BORGSTORE_TEST_S3_URL="s3:/test/path"
Expand All @@ -112,6 +113,7 @@ def check_s3_available():
be.destroy()
return True


sftp_is_available = check_sftp_available()
rclone_is_available = check_rclone_available()
s3_is_available = check_s3_available()
Expand Down Expand Up @@ -165,9 +167,11 @@ def get_backend_from_fixture(tested_backends, request):
return request.getfixturevalue(tested_backends)


@pytest.mark.parametrize(
"url,path", [("file:///absolute/path", "/absolute/path")] # first 2 slashes are to introduce host (empty here)
)
POSIX_ABS_TESTCASES = [("file:///absolute/path", "/absolute/path")]
WINDOWS_ABS_TESTCASES = [("file:///C:/absolute/path", "C:/absolute/path")]


@pytest.mark.parametrize("url,path", WINDOWS_ABS_TESTCASES if os.name == "nt" else POSIX_ABS_TESTCASES)
def test_file_url(url, path):
backend = get_file_backend(url)
assert isinstance(backend, PosixFS)
Expand Down