[Git][debian-gis-team/rasterio][upstream] New upstream version 1.3.10

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Sat Apr 13 05:41:58 BST 2024



Bas Couwenberg pushed to branch upstream at Debian GIS Project / rasterio


Commits:
a6e74ba9 by Bas Couwenberg at 2024-04-13T06:23:20+02:00
New upstream version 1.3.10
- - - - -


20 changed files:

- .github/workflows/test_gdal_latest.yaml
- .github/workflows/tests.yaml
- CHANGES.txt
- Makefile
- ci/gdal-compile.sh
- docs/topics/vsi.rst
- pyproject.toml
- rasterio/__init__.py
- rasterio/_io.pyx
- rasterio/_warp.pyx
- rasterio/merge.py
- rasterio/rio/main.py
- rasterio/rio/merge.py
- requirements-dev.txt
- setup.py
- tests/test_cli_main.py
- tests/test_read_resample.py
- tests/test_rio_merge.py
- tests/test_rio_shapes.py
- tests/test_warnings.py


Changes:

=====================================
.github/workflows/test_gdal_latest.yaml
=====================================
@@ -1,10 +1,8 @@
 name: Test GDAL Latest
 
 on:
-  push:
-    branches: [ main, 'maint-*' ]
   schedule:
-    - cron:  '0 0 * * 0'
+    - cron:  '0 2 * * 1'
   pull_request:  # also build on PRs touching this file
     paths:
       - ".github/workflows/test_gdal_latest.yaml"
@@ -23,6 +21,10 @@ jobs:
       GDAL_DIR: ${{ github.workspace }}/gdal_install
       GDAL_DATA: ${{ github.workspace }}/gdal_install/share/gdal
       LD_LIBRARY_PATH: "${{ github.workspace }}/gdal_install/lib/:${LD_LIBRARY_PATH}"
+    strategy:
+      fail-fast: false
+      matrix:
+        gdal-branch: ['master', 'release/3.7']
     steps:
       - uses: actions/checkout at v3
       - name: Update
@@ -63,7 +65,7 @@ jobs:
             cmake \
             curl \
             git
-          bash ci/gdal-compile.sh git
+          bash ci/gdal-compile.sh git ${{ matrix.gdal-branch }}
 
       - name: Install dependencies
         run: |
@@ -73,8 +75,7 @@ jobs:
           python -m pip install --upgrade pip
           python -m pip wheel -r requirements-dev.txt
           python -m pip install -r requirements-dev.txt
-          python setup.py clean
-          python -m pip install --no-deps --force-reinstall --no-use-pep517 -e .[test]
+          python -m pip install --no-deps --force-reinstall -e .[test]
 
       - name: Test
         shell: bash


=====================================
.github/workflows/tests.yaml
=====================================
@@ -29,6 +29,55 @@ on:
     - cron:  '0 0 * * 0'
 
 jobs:
+  numpy_compat_test:
+    runs-on: ubuntu-latest
+    name: Build with Numpy 2.0.0rc1, test with 1.23.5
+    container: ghcr.io/osgeo/gdal:ubuntu-small-${{ matrix.gdal-version }}
+    env:
+        DEBIAN_FRONTEND: noninteractive
+    strategy:
+      fail-fast: false
+      matrix:
+        python-version: ['3.10']
+        gdal-version: ['3.8.4']
+
+    steps:
+      - uses: actions/checkout at v2
+
+      - name: Update
+        run: |
+          apt-get update
+          apt-get -y install software-properties-common
+          add-apt-repository -y ppa:deadsnakes/ppa
+          apt-get update
+
+      - name: Set up Python ${{ matrix.python-version }}
+        run: |
+          apt-get install -y --no-install-recommends \
+            python${{ matrix.python-version }} \
+            python${{ matrix.python-version }}-dev \
+            python${{ matrix.python-version }}-venv \
+            python3-pip \
+            g++
+
+      - name: build wheel with Numpy 2
+        run: |
+          python${{ matrix.python-version }} -m venv testenv
+          . testenv/bin/activate
+          python -m pip install --upgrade pip
+          python -m pip install build
+          python -m build
+
+      - name: run tests with Numpy 1
+        run: |
+          . testenv/bin/activate
+          python -m pip install numpy==1.23.5
+          python -m pip wheel -r requirements-dev.txt
+          python -m pip install dist/*.whl
+          python -m pip install boto3 hypothesis packaging pytest shapely
+          rm -rf rasterio
+          python -m pytest -v -m "not wheel" -rxXs
+
   docker_tests:
     runs-on: ubuntu-latest
     name: Docker | GDAL=${{ matrix.gdal-version }} | python=${{ matrix.python-version }}
@@ -72,7 +121,6 @@ jobs:
           python${{ matrix.python-version }} -m venv testenv
           . testenv/bin/activate
           python -m pip install --upgrade pip
-          python -m pip wheel -r requirements-dev.txt
           python -m pip install --no-deps --force-reinstall -e .[test]
 
       - name: run tests


=====================================
CHANGES.txt
=====================================
@@ -1,6 +1,29 @@
 Changes
 =======
 
+1.3.10 (2024-04-10)
+-------------------
+
+This version is compatible with recent versions of Numpy 1.x and Numpy
+2.0.0rc1.
+
+Packaging:
+
+- Wheels for Python versions >= 3.9 will be built using Numpy 2.0.0rc1 or
+  a newer version and will be compatible with the oldest supported Numpy 1.x.
+- Wheels for Python version 3.8 will be built using the oldest supported
+  version of NumPy and will not be compatible with Numpy 2.
+
+Bug fixes:
+
+- Rasterio's merge function and CLI command cannot handle rotated rasters. This
+  is now noted in documentation and an error will be raised if any input is
+  non-rectilinear (#3066).
+- Usage of pytest.warns(None) has been eliminated (#3054).
+- All use of pkg_resouces has been eliminated (#3054).
+- Adjust several tests to small differences in output between GDAL 3.7 and 3.8
+  (#2959).
+
 1.3.9 (2023-10-18)
 ------------------
 


=====================================
Makefile
=====================================
@@ -33,6 +33,9 @@ dockertestimage:
 dockertest: dockertestimage
 	docker run -it -v $(shell pwd):/app --env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --entrypoint=/bin/bash rasterio:$(GDAL)-py$(PYTHON_VERSION) -c '/venv/bin/python setup.py develop && /venv/bin/python -B -m pytest -m "not wheel" --cov rasterio --cov-report term-missing $(OPTS)'
 
+dockernumpytest: dockertestimage
+	docker run -it -v $(shell pwd):/app --env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --entrypoint=/bin/bash rasterio:$(GDAL)-py$(PYTHON_VERSION) -c '/venv/bin/python -m build && /venv/bin/python -m pip install numpy==1.23.5 && /venv/bin/python -m pip install dist/*.whl && /venv/bin/python -B -m pytest -m "not wheel" --cov rasterio --cov-report term-missing $(OPTS)'
+
 dockershell: dockertestimage
 	docker run -it -v $(shell pwd):/app --env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --entrypoint=/bin/bash rasterio:$(GDAL)-py$(PYTHON_VERSION) -c '/venv/bin/python setup.py develop && /bin/bash'
 


=====================================
ci/gdal-compile.sh
=====================================
@@ -7,7 +7,7 @@ echo "Building GDAL ($1) from source..."
 BUILD_GDAL_DIR=gdal-${1:0:5}
 # Download PROJ
 if [[ $1 == "git" ]]; then
-  git clone https://github.com/OSGeo/GDAL.git ${BUILD_GDAL_DIR}
+  git clone https://github.com/OSGeo/GDAL.git --branch $2 ${BUILD_GDAL_DIR}
 else
   curl https://download.osgeo.org/gdal/${1:0:5}/gdal-$1.tar.gz > ${BUILD_GDAL_DIR}.tar.gz
   tar zxf ${BUILD_GDAL_DIR}.tar.gz


=====================================
docs/topics/vsi.rst
=====================================
@@ -1,10 +1,60 @@
-Virtual Files
-=============
+Virtual Filesystems
+===================
 
-.. todo::
+Rasterio uses GDAL's `virtual filesystem interface <https://gdal.org/user/virtual_file_systems.html>`__ to access datasets
+on the web, in cloud storage, in archive files, and in Python objects. Rasterio maps familiar URI schemes to GDAL virtual filesystem handlers. For example, the ``https`` URI scheme maps to GDAL's ``/vsicurl/``. The ``file`` URI scheme maps to GDAL's ordinary filesystem handler and is the default for dataset URIs that have no other scheme.
 
-    Support for URIs describing zip, s3, https resources.
-    Relationship to GDAL vsicurl, vsis3 et al.
+To access a dataset in a local ZIP file like the one in Rasterio's test suite, preprend ``zip`` to the URI of the local file and add the interior path to the dataset after a ``!`` character. For example:
+
+.. code-block:: python
+
+    with rasterio.open("zip+file://tests/data/files.zip!RGB.byte.tif") as src:
+        print(src.shape)
+
+    # Printed:
+    # (718, 791)
+
+Or use ``zip`` as shorthand for ``zip+file``.
+
+.. code-block:: python
+
+    with rasterio.open("zip://tests/data/files.zip!RGB.byte.tif") as src:
+        print(src.shape)
+
+    # Printed:
+    # (718, 791)
+
+Similarly, datasets in ZIP files served on the web can be accessed by using ``zip+https``.
+
+.. code-block:: python
+
+    with rasterio.open("zip+https://github.com/rasterio/rasterio/files/13675561/files.zip!RGB.byte.tif") as src:
+        print(src.shape)
+
+    # Printed:
+    # (718, 791)
+
+Tar and gzip archives can be accessed in the same manner by prepending with ``tar`` or ``gz`` instead of ``zip``.
+
+For compatibility with legacy systems and workflows or very niche use cases, Rasterio can also use GDAL's VSI filenames.
+
+.. code-block:: python
+
+    with rasterio.open("/vsizip/vsicurl/https://github.com/rasterio/rasterio/files/13675561/files.zip/RGB.byte.tif") as src:
+        print(src.shape)
+
+    # Printed:
+    # (718, 791)
+
+The prefixes on which GDAL filesystem handlers are registered are considered by Rasterio to be an implementation detail. You shouldn't need to think about them when using Rasterio. Use familiar and standard URIs instead, like elsewhere on the internet.
+
+.. code-block:: python
+
+    with rasterio.open("https://github.com/rasterio/rasterio/raw/main/tests/data/RGB.byte.tif") as src:
+        print(src.shape)
+
+    # Printed:
+    # (718, 791)
 
 AWS S3
 ------
@@ -25,7 +75,7 @@ your code.
 
 .. code-block:: python
 
-    with rasterio.open('s3://landsat-pds/L8/139/045/LC81390452014295LGN00/LC81390452014295LGN00_B1.TIF') as src:
+    with rasterio.open("s3://landsat-pds/L8/139/045/LC81390452014295LGN00/LC81390452014295LGN00_B1.TIF") as src:
         print(src.profile)
 
     # Printed:


=====================================
pyproject.toml
=====================================
@@ -1,5 +1,12 @@
 [build-system]
-requires = ["setuptools>=67.8", "wheel", "cython~=3.0.2", "oldest-supported-numpy"]
+requires = [
+    "setuptools>=67.8",
+    "wheel",
+    "cython~=3.0.2",
+    "numpy==2.0.0rc1; python_version >= '3.9'",
+    "oldest-supported-numpy; python_version < '3.9'"
+]
+
 build-backend = "setuptools.build_meta"
 
 [tool.pytest.ini_options]


=====================================
rasterio/__init__.py
=====================================
@@ -81,7 +81,7 @@ except ImportError:
     have_vsi_plugin = False
 
 __all__ = ['band', 'open', 'pad', 'Env', 'CRS']
-__version__ = "1.3.9"
+__version__ = "1.3.10"
 __gdal_version__ = gdal_version()
 __proj_version__ = ".".join([str(version) for version in get_proj_version()])
 __geos_version__ = ".".join([str(version) for version in get_geos_version()])


=====================================
rasterio/_io.pyx
=====================================
@@ -46,6 +46,8 @@ from rasterio._err cimport exc_wrap_int, exc_wrap_pointer, exc_wrap_vsilfile
 
 cimport numpy as np
 
+np.import_array()
+
 log = logging.getLogger(__name__)
 
 gdal33_version_checked = False


=====================================
rasterio/_warp.pyx
=====================================
@@ -42,6 +42,7 @@ from rasterio._io cimport (
 from rasterio._features cimport GeomBuilder, OGRGeomBuilder
 from rasterio.crs cimport CRS
 
+np.import_array()
 log = logging.getLogger(__name__)
 
 # Gauss (7) is not supported for warp
@@ -50,6 +51,7 @@ SUPPORTED_RESAMPLING = [r for r in Resampling if r.value != 7 and r.value <= 13]
 if GDALVersion.runtime().at_least('3.3'):
     SUPPORTED_RESAMPLING.append(Resampling.rms)
 
+
 def recursive_round(val, precision):
     """Recursively round coordinates."""
     if isinstance(val, (int, float)):
@@ -57,6 +59,7 @@ def recursive_round(val, precision):
     else:
         return [recursive_round(part, precision) for part in val]
 
+
 cdef object _transform_single_geom(
     object single_geom,
     OGRGeometryFactory *factory,


=====================================
rasterio/merge.py
=====================================
@@ -106,7 +106,7 @@ def merge(
     """Copy valid pixels from input files to an output file.
 
     All files must have the same number of bands, data type, and
-    coordinate reference system.
+    coordinate reference system. Rotated rasters cannot be merged.
 
     Input files are merged in their listed order using the reverse
     painter's algorithm (default) or another method. If the output file exists,
@@ -248,6 +248,8 @@ def merge(
         ys = []
         for dataset in datasets:
             with dataset_opener(dataset) as src:
+                if not src.transform.is_rectilinear:
+                    raise ValueError("Rotated, non-rectilinear rasters cannot be merged.")
                 left, bottom, right, top = src.bounds
             xs.extend([left, right])
             ys.extend([bottom, top])


=====================================
rasterio/rio/main.py
=====================================
@@ -30,15 +30,19 @@ Please add yours to the registry
 so that other ``rio`` users may find it.
 """
 
-
+import itertools
 import logging
-from pkg_resources import iter_entry_points
 import sys
 
 from click_plugins import with_plugins
 import click
 import cligj
 
+if sys.version_info < (3, 10):
+    from importlib_metadata import entry_points
+else:
+    from importlib.metadata import entry_points
+
 from . import options
 import rasterio
 from rasterio.session import AWSSession
@@ -64,11 +68,11 @@ def show_versions_cb(ctx, param, value):
     ctx.exit()
 
 
-
 @with_plugins(
-    ep
-    for ep in list(iter_entry_points("rasterio.rio_commands"))
-    + list(iter_entry_points("rasterio.rio_plugins"))
+    itertools.chain(
+        entry_points(group="rasterio.rio_commands"),
+        entry_points(group="rasterio.rio_plugins")
+    )
 )
 @click.group()
 @cligj.verbose_opt


=====================================
rasterio/rio/merge.py
=====================================
@@ -59,7 +59,7 @@ def merge(
     """Copy valid pixels from input files to an output file.
 
     All files must have the same number of bands, data type, and
-    coordinate reference system.
+    coordinate reference system. Rotated rasters cannot be merged.
 
     Input files are merged in their listed order using the reverse
     painter's algorithm. If the output file exists, its values will be


=====================================
requirements-dev.txt
=====================================
@@ -1,6 +1,7 @@
 -r requirements.txt
 
 # development specific requirements
+build
 cython~=0.29
 delocate
 hypothesis


=====================================
setup.py
=====================================
@@ -267,6 +267,7 @@ inst_reqs = [
     "certifi",
     "click>=4.0",
     "cligj>=0.5",
+    'importlib-metadata;python_version<"3.10"',
     "numpy",
     "snuggs>=1.4.1",
     "click-plugins",


=====================================
tests/test_cli_main.py
=====================================
@@ -1,7 +1,7 @@
-from pkg_resources import iter_entry_points
+"""Basic test of the CLI version and command plugins."""
 
 import rasterio
-from rasterio.rio.main import main_group
+from rasterio.rio.main import entry_points, main_group
 
 
 def test_version(runner):
@@ -14,5 +14,5 @@ def test_all_registered():
     # This test makes sure that all of the subcommands defined in the
     # rasterio.rio_commands entry-point are actually registered to the main
     # cli group.
-    for ep in iter_entry_points('rasterio.rio_commands'):
+    for ep in entry_points(group="rasterio.rio_commands"):
         assert ep.name in main_group.commands


=====================================
tests/test_read_resample.py
=====================================
@@ -103,4 +103,4 @@ def test_resampling_rms():
         expected = np.array([
             [1.35266399, 0.95388681],
             [0.29308701, 1.54074657]], dtype=np.float32)
-        assert (rms == expected).all()  # all True.
+        assert np.allclose(rms, expected)


=====================================
tests/test_rio_merge.py
=====================================
@@ -1,6 +1,6 @@
 """Unittests for $ rio merge"""
 
-
+from io import StringIO
 import os
 import sys
 import textwrap
@@ -521,15 +521,17 @@ def test_merge_precision(tmpdir, precision):
         xllcorner    0.000000000000
         yllcorner    0.000000000000
         cellsize     1.000000000000
-         1 2 3 4 1 2 3 4
-         3 4 5 6 3 4 5 6
-         4 5 6 8 4 5 6 8
-         7 9 5 4 7 9 5 4
-         1 2 3 4 1 2 3 4
-         3 4 5 6 3 4 5 6
-         4 5 6 8 4 5 6 8
-         7 9 5 4 7 9 5 4
-         """
+        1 2 3 4 1 2 3 4
+        3 4 5 6 3 4 5 6
+        4 5 6 8 4 5 6 8
+        7 9 5 4 7 9 5 4
+        1 2 3 4 1 2 3 4
+        3 4 5 6 3 4 5 6
+        4 5 6 8 4 5 6 8
+        7 9 5 4 7 9 5 4
+        """
+
+    expected_file = StringIO(textwrap.dedent(expected))
 
     template = """\
         ncols 4
@@ -556,7 +558,19 @@ def test_merge_precision(tmpdir, precision):
     runner = CliRunner()
     result = runner.invoke(main_group, ["merge", "-f", "AAIGrid"] + precision + inputs + [outputname])
     assert result.exit_code == 0
-    assert open(outputname).read() == textwrap.dedent(expected)
+
+    # The arrangement of whitespace in the data part of the file
+    # changed between 3.7 and 3.8 to better conform. We will compare
+    # in a way that is more independent.
+    with open(outputname) as out_file:
+        # Compare header lines.
+        for i in range(5):
+            assert out_file.readline().strip() == expected_file.readline().strip()
+        
+        # Compare raster data as single strings.
+        out_data = " ".join(line.strip() for line in out_file.readlines())
+        expected_data = " ".join(line.strip() for line in expected_file.readlines())
+        assert out_data == expected_data
 
 
 @fixture(scope='function')


=====================================
tests/test_rio_shapes.py
=====================================
@@ -19,16 +19,15 @@ def bbox(*args):
 
 
 def test_shapes(runner, pixelated_image_file):
-    with pytest.warns(None):
+    result = runner.invoke(main_group, ["shapes", "--collection", pixelated_image_file])
 
-        result = runner.invoke(main_group, ['shapes', '--collection', pixelated_image_file])
-
-        assert result.exit_code == 0
-        assert result.output.count('"FeatureCollection"') == 1
-        assert result.output.count('"Feature"') == 4
-        assert np.allclose(
-            json.loads(result.output)['features'][0]['geometry']['coordinates'],
-            [[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]])
+    assert result.exit_code == 0
+    assert result.output.count('"FeatureCollection"') == 1
+    assert result.output.count('"Feature"') == 4
+    assert np.allclose(
+        json.loads(result.output)["features"][0]["geometry"]["coordinates"],
+        [[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]],
+    )
 
 
 def test_shapes_invalid_bidx(runner, pixelated_image_file):
@@ -44,15 +43,14 @@ def test_shapes_sequence(runner, pixelated_image_file):
     --sequence option should produce 4 features in series rather than
     inside a feature collection.
     """
-    with pytest.warns(None):
-
-        result = runner.invoke(
-            main_group, ['shapes', '--collection', pixelated_image_file, '--sequence'])
+    result = runner.invoke(
+        main_group, ["shapes", "--collection", pixelated_image_file, "--sequence"]
+    )
 
-        assert result.exit_code == 0
-        assert result.output.count('"FeatureCollection"') == 0
-        assert result.output.count('"Feature"') == 4
-        assert result.output.count('\n') == 4
+    assert result.exit_code == 0
+    assert result.output.count('"FeatureCollection"') == 0
+    assert result.output.count('"Feature"') == 4
+    assert result.output.count("\n") == 4
 
 
 def test_shapes_sequence_rs(runner, pixelated_image_file):
@@ -91,29 +89,27 @@ def test_shapes_indent(runner, pixelated_image_file):
     """
     --indent option should produce lots of newlines and contiguous spaces
     """
-    with pytest.warns(None):
-
-        result = runner.invoke(
-            main_group, ['shapes', '--collection', pixelated_image_file, '--indent', 2])
+    result = runner.invoke(
+        main_group, ["shapes", "--collection", pixelated_image_file, "--indent", 2]
+    )
 
-        assert result.exit_code == 0
-        assert result.output.count('"FeatureCollection"') == 1
-        assert result.output.count('"Feature"') == 4
-        assert result.output.count("\n") > 100
-        assert result.output.count("        ") > 100
+    assert result.exit_code == 0
+    assert result.output.count('"FeatureCollection"') == 1
+    assert result.output.count('"Feature"') == 4
+    assert result.output.count("\n") > 100
+    assert result.output.count("        ") > 100
 
 
 def test_shapes_compact(runner, pixelated_image_file):
-    with pytest.warns(None):
-
-        result = runner.invoke(
-            main_group, ['shapes', '--collection', pixelated_image_file, '--compact'])
+    result = runner.invoke(
+        main_group, ["shapes", "--collection", pixelated_image_file, "--compact"]
+    )
 
-        assert result.exit_code == 0
-        assert result.output.count('"FeatureCollection"') == 1
-        assert result.output.count('"Feature"') == 4
-        assert result.output.count(', ') == 0
-        assert result.output.count(': ') == 0
+    assert result.exit_code == 0
+    assert result.output.count('"FeatureCollection"') == 1
+    assert result.output.count('"Feature"') == 4
+    assert result.output.count(", ") == 0
+    assert result.output.count(": ") == 0
 
 
 def test_shapes_sampling(runner, pixelated_image_file):
@@ -150,13 +146,13 @@ def test_shapes_mask(runner, pixelated_image, pixelated_image_file):
     with rasterio.open(pixelated_image_file, 'r+') as out:
         out.write(pixelated_image, indexes=1)
 
-    with pytest.warns(None):
-        result = runner.invoke(
-            main_group, ['shapes', '--collection', pixelated_image_file, '--mask'])
-        assert result.exit_code == 0
-        assert result.output.count('"FeatureCollection"') == 1
-        assert result.output.count('"Feature"') == 1
-        assert shape(json.loads(result.output)["features"][0]["geometry"]).area == 31.0
+    result = runner.invoke(
+        main_group, ["shapes", "--collection", pixelated_image_file, "--mask"]
+    )
+    assert result.exit_code == 0
+    assert result.output.count('"FeatureCollection"') == 1
+    assert result.output.count('"Feature"') == 1
+    assert shape(json.loads(result.output)["features"][0]["geometry"]).area == 31.0
 
 
 def test_shapes_mask_sampling(runner, pixelated_image, pixelated_image_file):
@@ -173,16 +169,15 @@ def test_shapes_mask_sampling(runner, pixelated_image, pixelated_image_file):
     with rasterio.open(pixelated_image_file, 'r+') as out:
         out.write(pixelated_image, indexes=1)
 
-    with pytest.warns(None):
-
-        result = runner.invoke(
-            main_group,
-            ['shapes', '--collection', pixelated_image_file, '--mask', '--sampling', 5])
+    result = runner.invoke(
+        main_group,
+        ["shapes", "--collection", pixelated_image_file, "--mask", "--sampling", 5],
+    )
 
-        assert result.exit_code == 0
-        assert result.output.count('"FeatureCollection"') == 1
-        assert result.output.count('"Feature"') == 1
-        assert shape(json.loads(result.output)["features"][0]["geometry"]).area == 25.0
+    assert result.exit_code == 0
+    assert result.output.count('"FeatureCollection"') == 1
+    assert result.output.count('"Feature"') == 1
+    assert shape(json.loads(result.output)["features"][0]["geometry"]).area == 25.0
 
 
 def test_shapes_band1_as_mask(runner, pixelated_image, pixelated_image_file):
@@ -198,12 +193,20 @@ def test_shapes_band1_as_mask(runner, pixelated_image, pixelated_image_file):
     with rasterio.open(pixelated_image_file, 'r+') as out:
         out.write(pixelated_image, indexes=1)
 
-    with pytest.warns(None):
-        result = runner.invoke(
-            main_group,
-            ['shapes', '--collection', pixelated_image_file, '--band', '--bidx', '1', '--as-mask'])
+    result = runner.invoke(
+        main_group,
+        [
+            "shapes",
+            "--collection",
+            pixelated_image_file,
+            "--band",
+            "--bidx",
+            "1",
+            "--as-mask",
+        ],
+    )
 
-        assert result.exit_code == 0
-        assert result.output.count('"FeatureCollection"') == 1
-        assert result.output.count('"Feature"') == 3
-        assert shape(json.loads(result.output)["features"][0]["geometry"]).area == 1.0
+    assert result.exit_code == 0
+    assert result.output.count('"FeatureCollection"') == 1
+    assert result.output.count('"Feature"') == 3
+    assert shape(json.loads(result.output)["features"][0]["geometry"]).area == 1.0


=====================================
tests/test_warnings.py
=====================================
@@ -36,8 +36,5 @@ def test_no_notgeoref_warning(transform, gcps, rpcs):
             if rpcs:
                 src.rpcs = rpcs
 
-        with pytest.warns(None) as record:
-            with mem.open() as dst:
-                pass
-        
-        assert len(record) == 0
+        with mem.open() as dst:
+            pass



View it on GitLab: https://salsa.debian.org/debian-gis-team/rasterio/-/commit/a6e74ba9f2d24c8502ac7dcb4b0b3e92b61a7508

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/rasterio/-/commit/a6e74ba9f2d24c8502ac7dcb4b0b3e92b61a7508
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20240413/e1d72a58/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list