Skip to content

Commit 42f82a9

Browse files
authored
Return info for archive FSs root (#996)
* Return info for archive FSs * only if archive is not empty * update test py versions
1 parent b5b7429 commit 42f82a9

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

.github/workflows/main.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
TOXENV: [py37, py38, py39, s3fs, gcsfs]
16+
TOXENV: [py38, py39, py310, s3fs, gcsfs]
1717

1818
env:
1919
TOXENV: ${{ matrix.TOXENV }}
@@ -42,7 +42,7 @@ jobs:
4242
strategy:
4343
fail-fast: false
4444
matrix:
45-
TOXENV: [py38]
45+
TOXENV: [py39]
4646

4747
env:
4848
TOXENV: ${{ matrix.TOXENV }}

fsspec/archive.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ def _all_dirnames(self, paths):
3434
def info(self, path, **kwargs):
3535
self._get_dirs()
3636
path = self._strip_protocol(path)
37+
if path in {"", "/"} and self.dir_cache:
38+
return {"name": "/", "type": "directory", "size": 0}
3739
if path in self.dir_cache:
3840
return self.dir_cache[path]
3941
elif path + "/" in self.dir_cache:

fsspec/implementations/tests/test_zip.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,10 @@ def test_not_cached():
3939
fs = fsspec.filesystem("zip", fo=z)
4040
fs2 = fsspec.filesystem("zip", fo=z)
4141
assert fs is not fs2
42+
43+
44+
def test_root_info():
45+
with tempzip(archive_data) as z:
46+
fs = fsspec.filesystem("zip", fo=z)
47+
assert fs.info("/") == {"name": "/", "type": "directory", "size": 0}
48+
assert fs.info("") == {"name": "/", "type": "directory", "size": 0}

tox.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# content of: tox.ini , put in same dir as setup.py
22
[tox]
3-
envlist = {py37,py38,py39}
3+
envlist = {py38,py39,py310}
44

55
[core]
66
conda_channels=
@@ -41,7 +41,6 @@ conda_deps=
4141
deps=
4242
hadoop-test-cluster==0.1.0
4343
smbprotocol
44-
py37: importlib_metadata
4544

4645
[testenv]
4746
description=Run test suite against target versions.

0 commit comments

Comments
 (0)