Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -42,7 +45,6 @@ jobs:
os: ubuntu-latest
python: '3.12'
toxenv: py312-test-cov
toxposargs: --remote-data

cov:
name: Coverage
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions opacity/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
"""
This module contains package tests.
"""
33 changes: 26 additions & 7 deletions opacity/tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
)
1 change: 1 addition & 0 deletions opacity/tests/test_filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from opacity import get_available_datasets


@pytest.mark.remote_data
@pytest.mark.parametrize(
"zarr_name,",
[
Expand Down
Loading