diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index c69006b2..a66f633d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -22,6 +22,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 + with: + python-version: '3.10' - uses: pre-commit/action@v3.0.1 docker_tests: diff --git a/test/conftest.py b/test/conftest.py index 46b8ad47..1d2abf67 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -16,6 +16,7 @@ TEST_INPUT_DATA_DIR = os.path.join(TEST_DATA_DIR, "input") TEST_COMPARE_DATA_DIR = os.path.join(TEST_DATA_DIR, "compare") RASTERIO_GE_14 = version.parse(rasterio.__version__) >= version.parse("1.4.0") +RASTERIO_GE_143 = version.parse(rasterio.__version__) >= version.parse("1.4.3") GDAL_GE_36 = version.parse(rasterio.__gdal_version__) >= version.parse("3.6.0") GDAL_GE_361 = version.parse(rasterio.__gdal_version__) >= version.parse("3.6.1") GDAL_GE_364 = version.parse(rasterio.__gdal_version__) >= version.parse("3.6.4") diff --git a/test/integration/test_integration__io.py b/test/integration/test_integration__io.py index 1801f27a..164c1778 100644 --- a/test/integration/test_integration__io.py +++ b/test/integration/test_integration__io.py @@ -1,6 +1,7 @@ import contextlib import io import itertools +import logging import os import pickle import shutil @@ -863,13 +864,19 @@ def test_http_url(): assert isinstance(actual.data, dask.array.Array) -def test_rasterio_environment(): +def test_rasterio_environment(tmp_path): + log = logging.getLogger("rasterio._env") + log.setLevel(logging.DEBUG) + logfile = tmp_path / "file.log" + fh = logging.FileHandler(logfile) + log.addHandler(fh) with create_tmp_geotiff() as (tmp_file, expected): # Should fail with error since suffix not allowed - with pytest.raises(Exception): - with rasterio.Env(GDAL_SKIP="GTiff"): - with rioxarray.open_rasterio(tmp_file) as actual: - assert_allclose(actual, expected) + with rasterio.Env(CPL_DEBUG=True): + with rioxarray.open_rasterio(tmp_file) as actual: + assert_allclose(actual.load(), expected) + + assert f"GDAL: GDALOpen({tmp_file}" in logfile.read_text() @pytest.mark.parametrize("band_as_variable", [True, False]) diff --git a/test/integration/test_integration_merge.py b/test/integration/test_integration_merge.py index e135e386..d22ae4fe 100644 --- a/test/integration/test_integration_merge.py +++ b/test/integration/test_integration_merge.py @@ -7,7 +7,7 @@ from rioxarray import open_rasterio from rioxarray.merge import merge_arrays, merge_datasets -from test.conftest import RASTERIO_GE_14, TEST_INPUT_DATA_DIR +from test.conftest import RASTERIO_GE_14, RASTERIO_GE_143, TEST_INPUT_DATA_DIR @pytest.mark.parametrize("squeeze", [True, False]) @@ -90,7 +90,7 @@ def test_merge__different_crs(dataset): (-7300984.0238134, 5003618.5908794, -7224054.1109682, 5050108.6101528), ) assert merged.rio.shape == (84, 139) - if RASTERIO_GE_14: + if RASTERIO_GE_14 and not RASTERIO_GE_143: assert_almost_equal(test_sum, -126821853) else: assert_almost_equal(test_sum, -131734881)