Skip to content

Commit

Permalink
Alter find test because debian filenames changed
Browse files Browse the repository at this point in the history
Don't check explicit names, check for consistency of PFT and HTTPS
  • Loading branch information
Martin Durant committed Feb 10, 2021
1 parent 36182d0 commit 19b28c6
Showing 1 changed file with 17 additions and 46 deletions.
63 changes: 17 additions & 46 deletions fsspec/tests/test_spec.py
Expand Up @@ -179,55 +179,26 @@ def test_expand_path_recursive(test_paths, expected):
assert sorted(paths) == sorted(expected)


@pytest.mark.parametrize(
["filesystem", "host", "test_path", "expected"],
[
(
FTPFileSystem,
"ftp.fau.de",
"ftp://ftp.fau.de/debian-cd/current/amd64/log/success",
[
"/debian-cd/current/amd64/log/success/BD.log",
"/debian-cd/current/amd64/log/success/DLBD.log",
"/debian-cd/current/amd64/log/success/DVD.log",
"/debian-cd/current/amd64/log/success/EDUNI.log",
"/debian-cd/current/amd64/log/success/EDUUSB.log",
"/debian-cd/current/amd64/log/success/MACNI.log",
"/debian-cd/current/amd64/log/success/NI.log",
"/debian-cd/current/amd64/log/success/USB16G.log",
"/debian-cd/current/amd64/log/success/XFCECD.log",
],
),
(
HTTPFileSystem,
"https://ftp.fau.de",
"https://ftp.fau.de/debian-cd/current/amd64/log/success",
[
"https://ftp.fau.de/debian-cd/current/amd64/log/success",
"https://ftp.fau.de/debian-cd/current/amd64/log/success/?C=D;O=A",
"https://ftp.fau.de/debian-cd/current/amd64/log/success/?C=M;O=A",
"https://ftp.fau.de/debian-cd/current/amd64/log/success/?C=N;O=D",
"https://ftp.fau.de/debian-cd/current/amd64/log/success/?C=S;O=A",
"https://ftp.fau.de/debian-cd/current/amd64/log/success/BD.log",
"https://ftp.fau.de/debian-cd/current/amd64/log/success/DLBD.log",
"https://ftp.fau.de/debian-cd/current/amd64/log/success/DVD.log",
"https://ftp.fau.de/debian-cd/current/amd64/log/success/EDUNI.log",
"https://ftp.fau.de/debian-cd/current/amd64/log/success/EDUUSB.log",
"https://ftp.fau.de/debian-cd/current/amd64/log/success/MACNI.log",
"https://ftp.fau.de/debian-cd/current/amd64/log/success/NI.log",
"https://ftp.fau.de/debian-cd/current/amd64/log/success/USB16G.log",
"https://ftp.fau.de/debian-cd/current/amd64/log/success/XFCECD.log",
],
),
],
)
def test_find(filesystem, host, test_path, expected):
""" Test .find() method on debian server (available as ftp and https) with constant folder """
def test_find():
""" Test .find() method on debian server (ftp, https) with constant folder """
filesystem, host, test_path = (
FTPFileSystem,
"ftp.fau.de",
"ftp://ftp.fau.de/debian-cd/current/amd64/log/success",
)
test_fs = filesystem(host)
filenames_ftp = test_fs.find(test_path)

filenames = test_fs.find(test_path)
filesystem, host, test_path = (
HTTPFileSystem,
"https://ftp.fau.de",
"https://ftp.fau.de/debian-cd/current/amd64/log/success",
)
test_fs = filesystem()
filenames_http = test_fs.find(test_path)
roots = [f.rsplit("/", 1)[-1] for f in filenames_http]

assert filenames == expected
assert all(f.rsplit("/", 1)[-1] in roots for f in filenames_ftp)


def test_find_details():
Expand Down

0 comments on commit 19b28c6

Please sign in to comment.