diff --git a/src/borgstore/backends/posixfs.py b/src/borgstore/backends/posixfs.py index e6b8830..12576ab 100644 --- a/src/borgstore/backends/posixfs.py +++ b/src/borgstore/backends/posixfs.py @@ -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] diff --git a/tests/test_backends.py b/tests/test_backends.py index 854a502..85133d1 100644 --- a/tests/test_backends.py +++ b/tests/test_backends.py @@ -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" @@ -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() @@ -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)