Skip to content

tests: Give pytest.approx one coordinate pair at a time - #8120

Merged
echoix merged 1 commit into
OSGeo:mainfrom
alteralto:tests-approx-nested
Oct 28, 2026
Merged

echoix merged 1 commit into
OSGeo:mainfrom
alteralto:tests-approx-nested

Conversation

@alteralto

Copy link
Copy Markdown
Contributor

pytest 9.2.0 raises TypeError for any nested container in pytest.approx() (pytest-dev/pytest#10210). Two tests pass a list of coordinate pairs and now fail in CI on all platforms:

  • vector/v.proj/tests/v_proj_test.py::test_smax_zero_matches_per_vertex_path
  • lib/cluster/tests/lib_cluster_exec_ctypes_test.py::test_exec_separates_two_well_separated_groups

Before 9.2.0 such a list was accepted, but each tuple was compared exactly, so the tolerance was never applied. These now compare each pair with its own pytest.approx().

This is the CI failure seen in #8116 and other open PRs.

Tested in the osgeo/grass-gis:main-alpine image: both test files pass with pytest 9.1.1 before and after, and with 9.2.0 the two tests fail on main and pass with this change. I also checked that the new form passes a 1e-6 difference and fails a real one.

Diagnosed and implemented with the help of Claude Code.

pytest 9.2.0 rejects nested containers in pytest.approx(). Before, a list
of tuples was accepted but each tuple was compared exactly, so the
tolerance was never applied. Compare each pair with its own approx.
@github-actions github-actions Bot added vector Related to vector data processing Python Related code is in Python libraries module tests Related to Test Suite labels Oct 28, 2026
@echoix
echoix enabled auto-merge (squash) October 28, 2026 12:04
@echoix
echoix merged commit f532115 into OSGeo:main Oct 28, 2026
26 checks passed
@github-actions github-actions Bot added this to the 8.6.0 milestone Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libraries module Python Related code is in Python tests Related to Test Suite vector Related to vector data processing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants