diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d67d9a8..e93723d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/snakemake_storage_plugin_gcs/__init__.py b/snakemake_storage_plugin_gcs/__init__.py index 31a4311..129a19d 100644 --- a/snakemake_storage_plugin_gcs/__init__.py +++ b/snakemake_storage_plugin_gcs/__init__.py @@ -189,11 +189,11 @@ def is_valid_query(cls, query: str) -> StorageQueryValidationResult: valid=False, reason=f"cannot be parsed as URL ({e})", ) - if parsed.scheme != "gs": + if parsed.scheme != "gcs": return StorageQueryValidationResult( query=query, valid=False, - reason="must start with gs (gs://...)", + reason="must start with gcs scheme (gcs://...)", ) return StorageQueryValidationResult( query=query, @@ -207,7 +207,7 @@ def example_queries(cls) -> List[ExampleQuery]: """ return [ ExampleQuery( - query="gs://mybucket/myfile.txt", + query="gcs://mybucket/myfile.txt", type=QueryType.ANY, description="A file in an google storage (GCS) bucket", ) @@ -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) diff --git a/tests/tests.py b/tests/tests.py index 3ae0628..c7fafa8 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -14,14 +14,15 @@ class TestStorage(TestStorageBase): __test__ = True + files_only = False def get_query(self, tmp_path) -> str: - return "gs://snakemake-test-bucket/test-file.txt" + return "gcs://snakemake-test-bucket/test-file.txt" def get_query_not_existing(self, tmp_path) -> str: bucket = uuid.uuid4().hex key = uuid.uuid4().hex - return f"gs://{bucket}/{key}" + return f"gcs://{bucket}/{key}" def get_storage_provider_cls(self) -> Type[StorageProviderBase]: # Return the StorageProvider class of this plugin