Skip to content

[Bug] pygrass – test_pygrass_doctests fails with Numpy 2 #4116

Description

@nilason

test_pygrass_doctests fails with Python 3.12 and Numpy 2.0.1 at least on Mac, which is a regression compared to current CI setup with Python 3.11 and Numpy 1.26.4.

test_pygrass_doctests

./python/grass/pygrass – test_pygrass_doctests

❌ Test failed

Test	test_pygrass_doctests
Testsuite	./python/grass/pygrass
Test file	./python/grass/pygrass/testsuite/test_pygrass_doctests.py
Status	FAILED
Return code	1
Number of tests	10
Successful tests	9
Failed tests	1
Percent successful	90%
Test duration	0:00:00.458122
Supplementary files

standard output (stdout)
standard error output (stderr)
Standard error output (stderr)

Building topology for vector map <Utils_test_vector@__python_grass_pygrass_test_pygrass_doctests_Mac_1722423178195_local_28327>...
Registering primitives...

Building areas...
0..9..18..27..36..45..54..63..72..81..90..100
Attaching islands...
0..50..100
Attaching centroids...
0..25..50..75..100
....Building topology for vector map <test_vect_2@__python_grass_pygrass_test_pygrass_doctests_Mac_1722423178195_local_28327>...
Registering primitives...

F.WARNING: Illegal filename <cénsus>. Character <Ã> not allowed.

....
======================================================================
FAIL: get_raster_for_points (grass.pygrass.utils)
Doctest: grass.pygrass.utils.get_raster_for_points
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/runner/micromamba/envs/grass-env/lib/python3.12/doctest.py", line 2256, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for grass.pygrass.utils.get_raster_for_points
  File "etc/python/grass/pygrass/utils.py", line 229, in get_raster_for_points

----------------------------------------------------------------------
File "etc/python/grass/pygrass/utils.py", line 278, in grass.pygrass.utils.get_raster_for_points
Failed example:
    l[0]  # doctest: +ELLIPSIS
Expected:
    (1, 10.0, 6.0, 1)
Got:
    (1, 10.0, 6.0, np.int32(1))
----------------------------------------------------------------------
File "etc/python/grass/pygrass/utils.py", line 280, in grass.pygrass.utils.get_raster_for_points
Failed example:
    l[1]  # doctest: +ELLIPSIS
Expected:
    (2, 12.0, 6.0, 1)
Got:
    (2, 12.0, 6.0, np.int32(1))


----------------------------------------------------------------------
Ran 10 tests in 0.207s
FAILED (failures=1)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    PythonRelated code is in PythonbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions