Skip to content

Commit

Permalink
fix: fix directory support (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester authored Apr 26, 2024
1 parent 2156981 commit ce3d165
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
poetry run python tests/test_fake_gcs.py
- name: Run pytest
run: poetry run coverage run -m pytest tests/tests.py
run: poetry run coverage run -m pytest -v tests/tests.py

- name: Run Coverage
run: poetry run coverage report -m
6 changes: 5 additions & 1 deletion snakemake_storage_plugin_gcs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,11 @@ def get_mtime(blob):
return blob.updated.timestamp()

if self.is_directory():
return max(get_mtime(blob) for blob in self.directory_entries())
entries = list(self.directory_entries())
assert (
entries
), f"bug: mtime called but directory does not seem to exist: {self.query}"
return max(get_mtime(blob) for blob in entries)
else:
return get_mtime(self.blob)

Expand Down
1 change: 1 addition & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

class TestStorage(TestStorageBase):
__test__ = True
files_only = False

def get_query(self, tmp_path) -> str:
return "gs://snakemake-test-bucket/test-file.txt"
Expand Down

0 comments on commit ce3d165

Please sign in to comment.