Skip to content

Commit 548d69a

Browse files
test_file_url: fix absolute path test case for windows, fixes #125
1 parent 06dcdd0 commit 548d69a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/test_backends.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def check_rclone_available():
8888
be.destroy()
8989
return True
9090

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

116+
115117
sftp_is_available = check_sftp_available()
116118
rclone_is_available = check_rclone_available()
117119
s3_is_available = check_s3_available()
@@ -165,9 +167,11 @@ def get_backend_from_fixture(tested_backends, request):
165167
return request.getfixturevalue(tested_backends)
166168

167169

168-
@pytest.mark.parametrize(
169-
"url,path", [("file:///absolute/path", "/absolute/path")] # first 2 slashes are to introduce host (empty here)
170-
)
170+
POSIX_ABS_TESTCASES = [("file:///absolute/path", "/absolute/path")]
171+
WINDOWS_ABS_TESTCASES = [("file:///C:/absolute/path", "C:/absolute/path")]
172+
173+
174+
@pytest.mark.parametrize("url,path", WINDOWS_ABS_TESTCASES if os.name == "nt" else POSIX_ABS_TESTCASES)
171175
def test_file_url(url, path):
172176
backend = get_file_backend(url)
173177
assert isinstance(backend, PosixFS)

0 commit comments

Comments
 (0)