From 3ba4480685258f07daf27029aae946b0d45473ef Mon Sep 17 00:00:00 2001 From: Ben Smith Date: Mon, 28 Sep 2026 09:49:01 -0700 Subject: [PATCH 1/2] tests: update missing-index tests for missing_index='error' default 04c2064 made read_ATL11_granule_cloud_items() raise FileNotFoundError for a missing geoIndex by default (missing_index='error'), with the old warn-and-skip behaviour available as missing_index='skip'. Two tests still expected the old default and failed. Pass missing_index='skip' in those, and add tests that the default raises, for both local and remote index paths. Co-Authored-By: Claude Opus 5.5 --- tests/test_cloud.py | 14 ++++++++++++-- tests/test_cloud_paths.py | 13 +++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/test_cloud.py b/tests/test_cloud.py index 7de944e..04941e1 100644 --- a/tests/test_cloud.py +++ b/tests/test_cloud.py @@ -8,6 +8,7 @@ import os import shutil import numpy as np +import pytest import pointCollection as pc from pointCollection.scripts.query_ATL11_cloud import ( read_ATL11_granule_cloud, read_ATL11_granule_cloud_items) @@ -106,9 +107,18 @@ def test_read_ATL11_granule_cloud_merges_items(tmp_path): assert merged.size == sum(Di.size for Di in items) +def test_read_ATL11_granule_cloud_items_missing_index_raises(tmp_path): + """by default, a missing index is a staging error""" + with pytest.raises(FileNotFoundError, match='missing geoIndex'): + read_ATL11_granule_cloud_items( + 'not-a-real-granule.h5', str(tmp_path / 'no_such_index.h5'), [-1, 1], [-1, 1]) + + def test_read_ATL11_granule_cloud_items_missing_index_returns_none(tmp_path): - items = read_ATL11_granule_cloud_items( - 'not-a-real-granule.h5', str(tmp_path / 'no_such_index.h5'), [-1, 1], [-1, 1]) + with pytest.warns(UserWarning, match='missing geoIndex'): + items = read_ATL11_granule_cloud_items( + 'not-a-real-granule.h5', str(tmp_path / 'no_such_index.h5'), [-1, 1], [-1, 1], + missing_index='skip') assert items is None diff --git a/tests/test_cloud_paths.py b/tests/test_cloud_paths.py index a7188b5..09f9f6e 100644 --- a/tests/test_cloud_paths.py +++ b/tests/test_cloud_paths.py @@ -200,14 +200,23 @@ def test_remote_index_is_not_reported_missing(tmp_path): assert items is not None and len(items) > 0 +def test_missing_remote_index_raises(tmp_path): + """by default, a remote index that really is absent is a staging error""" + index_fs = FakeS3FS({}) + with pytest.raises(FileNotFoundError, match='missing geoIndex'): + read_ATL11_granule_cloud_items( + 'ATL11_044110_0331_007_04.h5', 's3://bucket/no_such_index.h5', + [-1, 1], [-1, 1], index_fs=index_fs) + + def test_missing_remote_index_still_skips(tmp_path): - """a remote index that really is absent must still warn and skip""" + """with missing_index='skip', an absent remote index must warn and skip""" index_fs = FakeS3FS({}) import warnings with warnings.catch_warnings(record=True) as caught: warnings.simplefilter('always') items = read_ATL11_granule_cloud_items( 'ATL11_044110_0331_007_04.h5', 's3://bucket/no_such_index.h5', - [-1, 1], [-1, 1], index_fs=index_fs) + [-1, 1], [-1, 1], index_fs=index_fs, missing_index='skip') assert items is None assert any('missing geoIndex' in str(w.message) for w in caught) From 43f9f29a8c832069e44e3d31eeef6cf04edbbd33 Mon Sep 17 00:00:00 2001 From: Ben Smith Date: Mon, 28 Sep 2026 10:17:45 -0700 Subject: [PATCH 2/2] ci: add fsspec to the pixi dev environment tests/test_remote_cache.py (added in 2d438e1) imports fsspec at module level, but fsspec is only in the optional 'cloud' extra, not in the pixi dev environment CI runs in. Collection failed with ModuleNotFoundError and pytest stopped before running any tests (exit code 2). Add fsspec to [tool.pixi.feature.dev.dependencies] and re-lock with pixi 0.79.0, the version CI pins. The lock change only adds fsspec 2026.9.0. Checked with `pixi install --locked -e dev` and `pixi run coverage`: 268 passed, 4 skipped, test_remote_cache.py included. Co-Authored-By: Claude Opus 5.5 --- pixi.lock | 15 +++++++++++++++ pyproject.toml | 1 + 2 files changed, 16 insertions(+) diff --git a/pixi.lock b/pixi.lock index c85c41a..7da5669 100644 --- a/pixi.lock +++ b/pixi.lock @@ -861,6 +861,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/flake8-7.3.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/fonttools-4.61.1-pyh7db6752_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/fqdn-1.5.1-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/fsspec-2026.9.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/h11-0.16.0-pyhcf101f3_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/h2-4.3.0-pyhcf101f3_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/hpack-4.1.0-pyhd8ed1ab_0.conda @@ -987,6 +988,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/flake8-7.3.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/fonttools-4.61.1-pyh7db6752_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/fqdn-1.5.1-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/fsspec-2026.9.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/h11-0.16.0-pyhcf101f3_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/h2-4.3.0-pyhcf101f3_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/hpack-4.1.0-pyhd8ed1ab_0.conda @@ -1224,6 +1226,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/flake8-7.3.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/fonttools-4.61.1-pyh7db6752_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/fqdn-1.5.1-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/fsspec-2026.9.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/h11-0.16.0-pyhcf101f3_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/h2-4.3.0-pyhcf101f3_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/hpack-4.1.0-pyhd8ed1ab_0.conda @@ -3470,6 +3473,18 @@ packages: - pkg:pypi/fqdn?source=hash-mapping size: 16705 timestamp: 1733327494780 +- conda: https://conda.anaconda.org/conda-forge/noarch/fsspec-2026.9.0-pyhd8ed1ab_0.conda + sha256: 7d17272012e7479ba58f8a72b522d3e88e6837a04a111a278ff417aa82364255 + md5: 42de5cd170647599a84f468a42fabb89 + depends: + - python >=3.11 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/fsspec?source=compressed-mapping + run_exports: {} + size: 163722 + timestamp: 1790256848815 - conda: https://conda.anaconda.org/conda-forge/noarch/h11-0.16.0-pyhcf101f3_1.conda sha256: 96cac6573fd35ae151f4d6979bab6fbc90cb6b1fb99054ba19eb075da9822fcb md5: b8993c19b0c32a2f7b66cbb58ca27069 diff --git a/pyproject.toml b/pyproject.toml index d9e82a4..3623603 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -138,5 +138,6 @@ shapely = "*" [tool.pixi.feature.dev.dependencies] flake8 = "*" +fsspec = "*" pytest = ">=4.6" pytest-cov = "*"