Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests in test_parquet failing with TypeError: argument of type 'PosixPath' is not iterable #42

Closed
brl0 opened this issue Jul 25, 2020 · 1 comment

Comments

@brl0
Copy link
Collaborator

brl0 commented Jul 25, 2020

Multiple tests in test_parquet are failing with the same error message, and example of which is below:

____________________________________________________________ test_parquet ____________________________________________________________

tmp_path = PosixPath('/tmp/pytest-of-blarsen/pytest-0/test_parquet0')

    @given(
>       gp_point=st_point_array(min_size=1, geoseries=True),
        gp_multipoint=st_multipoint_array(min_size=1, geoseries=True),
        gp_multiline=st_multiline_array(min_size=1, geoseries=True),
    )
    @hyp_settings
    def test_parquet(gp_point, gp_multipoint, gp_multiline, tmp_path):

tests/test_parquet.py:24:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_parquet.py:43: in test_parquet
    df_read = read_parquet(path, columns=['point', 'multipoint', 'multiline', 'a'])
spatialpandas/io/parquet.py:103: in read_parquet
    filesystem = validate_coerce_filesystem(path, filesystem)
spatialpandas/io/utils.py:19: in validate_coerce_filesystem
    return fsspec.open(path).fs
../../miniconda3/envs/default/lib/python3.7/site-packages/fsspec/core.py:378: in open
    **kwargs
../../miniconda3/envs/default/lib/python3.7/site-packages/fsspec/core.py:222: in open_files
    chain = _un_chain(urlpath, kwargs)
../../miniconda3/envs/default/lib/python3.7/site-packages/fsspec/core.py:269: in _un_chain
    bits = [_un_chain(p, kwargs) for p in path]
../../miniconda3/envs/default/lib/python3.7/site-packages/fsspec/core.py:269: in <listcomp>
    bits = [_un_chain(p, kwargs) for p in path]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

path = PosixPath('/tmp/pytest-of-blarsen/pytest-0/test_parquet0/df.parq'), kwargs = {}

    def _un_chain(path, kwargs):
        if isinstance(path, (tuple, list)):
            bits = [_un_chain(p, kwargs) for p in path]
            out = []
            for pbit in zip(*bits):
                paths, protocols, kwargs = zip(*pbit)
                if len(set(protocols)) > 1:
                    raise ValueError("Protocol mismatch in URL chain")
                if len(set(paths)) == 1:
                    paths = paths[0]
                else:
                    paths = list(paths)
                out.append([paths, protocols[0], kwargs[0]])
            return out
        x = re.compile(".*[^a-z]+.*")  # test for non protocol-like single word
        bits = (
            [p if "://" in p or x.match(p) else p + "://" for p in path.split("::")]
>           if "::" in path
            else [path]
        )
E       TypeError: argument of type 'PosixPath' is not iterable

../../miniconda3/envs/default/lib/python3.7/site-packages/fsspec/core.py:284: TypeError

It appears that fsspec does not support Path objects. A simple fix would be to cast the Path object to str before passing to the function being tested.

@brl0 brl0 mentioned this issue Jul 26, 2020
@brl0
Copy link
Collaborator Author

brl0 commented Jul 27, 2020

Fixed in #37.

@brl0 brl0 closed this as completed Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant