diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0426ed7..1726013 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,16 +21,19 @@ jobs: linux: test os: ubuntu-latest python-version: 3.11 + toxposargs: --remote-data - name: py3.12 linux: test os: ubuntu-latest python-version: 3.12 + toxposargs: --remote-data - name: py3.13 linux: test os: ubuntu-latest python-version: 3.13 + toxposargs: --remote-data - name: Code style checks python: 3.11 @@ -42,7 +45,6 @@ jobs: os: ubuntu-latest python: '3.12' toxenv: py312-test-cov - toxposargs: --remote-data cov: name: Coverage @@ -61,7 +63,7 @@ jobs: pip install pytest pytest-cov pytest-doctestplus pytest-remotedata . - name: Run tests - run: pytest --cov --cov-branch --cov-report=xml + run: pytest --cov --cov-branch --cov-report=xml --remote-data - name: Upload results to Codecov uses: codecov/codecov-action@v5 diff --git a/opacity/tests/__init__.py b/opacity/tests/__init__.py index 92ea707..e69de29 100644 --- a/opacity/tests/__init__.py +++ b/opacity/tests/__init__.py @@ -1,3 +0,0 @@ -""" -This module contains package tests. -""" diff --git a/opacity/tests/test_dataset.py b/opacity/tests/test_dataset.py index 1f0dfe1..9994ef1 100644 --- a/opacity/tests/test_dataset.py +++ b/opacity/tests/test_dataset.py @@ -28,16 +28,23 @@ @pytest.mark.remote_data @pytest.mark.parametrize( - "species, coord, expected", [ - ('H2O', 'temperature', grid1460_temperature), - ('H2O', 'pressure', grid1460_pressure), - ('VO', 'temperature', grid1460_temperature), - ('VO', 'pressure', grid1460_pressure), + "species, coord, expected, set_local_cache_store,", [ + ('H2O', 'temperature', grid1460_temperature, True), + ('H2O', 'pressure', grid1460_pressure, False), + ('VO', 'temperature', grid1460_temperature, True), + ('VO', 'pressure', grid1460_pressure, False), ] ) -def test_open_dataset_cache_coordinates(tmpdir, species, coord, expected): +def test_open_dataset_cache_coordinates( + tmpdir, species, coord, expected, set_local_cache_store +): tmp_path = os.path.join(tmpdir, species + '.zarr') - local_cache_store = zarr.storage.LocalStore(tmp_path) + + if set_local_cache_store: + local_cache_store = zarr.storage.LocalStore(tmp_path) + else: + local_cache_store = None + ds = open_dataset( species=species, cache_path=tmp_path, @@ -63,3 +70,15 @@ def test_open_dataset_nocache_coordinates(tmpdir, species, coord, expected): max_cache_size_gb=1e-3 ) assert all(ds[coord] == expected) + + +def test_open_dataset_no_species(tmpdir, species=None): + with pytest.raises( + ValueError, + match="opacity.open_dataset requires a species*" + ): + _ = open_dataset( + species=species, + cache=False, + max_cache_size_gb=1e-3 + ) diff --git a/opacity/tests/test_filesystem.py b/opacity/tests/test_filesystem.py index 6c09be9..be88e2c 100644 --- a/opacity/tests/test_filesystem.py +++ b/opacity/tests/test_filesystem.py @@ -2,6 +2,7 @@ from opacity import get_available_datasets +@pytest.mark.remote_data @pytest.mark.parametrize( "zarr_name,", [