Skip to content

Commit

Permalink
Add a test verifying that code runs on GCS dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverwm1 committed Jan 20, 2025
1 parent d93f4b4 commit 873a3f1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"zarr>=2.3.0",
]

test_requirements = ["pytest"]
test_requirements = ["pytest", "gcsfs"]

setup(
author="Oliver Watt-Meyer",
Expand Down
13 changes: 13 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,16 @@ def test_dump_max_rows_limited(tmp_xarray_ds):
_, path = tmp_xarray_ds(consolidated=True, n_vars=30)
result = runner.invoke(dump, [path, "-m", 10])
assert len(result.output.split("\n")) < 20 # give some buffer over 10


def test_dump_executes_on_google_cloud_storage_url():
"""This test uses a public dataset on GCS which could disappear at any time.
Feel free to delete if it starts failing.
"""
runner = CliRunner()
url = "gs://cmip6/CMIP6/ScenarioMIP/NCAR/CESM2/ssp245/r1i1p1f1/Amon/tas/gn/v20190730"
result = runner.invoke(dump, [url])
assert result.exit_code == 0
assert "<xarray.Dataset>" in result.output
assert "Dimensions:" in result.output
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ deps =
click
pytest
fsspec
gcsfs
xarray16: xarray>=0.16.0,<0.17.0
xarray19: xarray>=0.19.0,<0.20.0
xarray21: xarray>=0.21.0,<0.22.0
Expand Down

0 comments on commit 873a3f1

Please sign in to comment.