Skip to content

tests: Add pytest coverage for the temporal framework and R-tree bindings - #7728

Merged
wenzeslaus merged 3 commits into
OSGeo:mainfrom
wenzeslaus:temporal-unit-tests-pytest-port
Jul 16, 2026
Merged

wenzeslaus merged 3 commits into
OSGeo:mainfrom
wenzeslaus:temporal-unit-tests-pytest-port

Conversation

@wenzeslaus

@wenzeslaus wenzeslaus commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

Add executed pytest tests for parts of the temporal framework and the
R-tree ctypes bindings that no test in CI covered. The cases build their
datasets in memory, so they need neither a temporal database nor a GRASS
session.

Details - grass_temporal_datetime_math_test.py: datetime increment by string and adjustment of a datetime to a granularity. - grass_temporal_granularity_test.py: absolute-time granularity of map lists of intervals, time points and a mix of both. - grass_temporal_topology_test.py: the temporal topology builder relations (overlaps, overlapped, follows, precedes, contains, during) and the map list sorting keys. Following TemporalExtent.overlaps, an interval that starts and ends earlier overlaps the later one. - grass_temporal_spatial_extent_test.py: the 2D and 3D spatial extent relations and intersection. - lib_vector_rtree_ctypes_test.py: the 1D to 4D R-tree search through the grass.lib ctypes bindings.

These checks previously existed only in grass.temporal.unit_tests, which
could not be imported and was not run, and in doctests that CI does not
execute.

The dead grass.temporal.unit_tests module, its Makefile entry, and the
pytest --ignore that skipped it are removed.

The module has been unimportable since the star imports were removed in
0c83c97: it imports adjust_datetime_to_granularity from
temporal_granularity, but that function lives in datetime_math. Nothing
imports the module, no test runner collects it (it is neither a pytest
tests/ file nor a gunittest testsuite/ file), and its own docstring calls
it deprecated, so the breakage went unnoticed for years. Sphinx autodoc
does reach it and reports the failed import as a warning. Remove the module
instead of resurrecting a test nothing runs.

Prepared with the assistance of AI (Claude Code).

@github-actions github-actions Bot added CI Continuous integration vector Related to vector data processing Python Related code is in Python libraries tests Related to Test Suite labels Jul 16, 2026
@wenzeslaus
wenzeslaus force-pushed the temporal-unit-tests-pytest-port branch from 1540924 to 126eb99 Compare July 16, 2026 08:03
…ings

Add executed pytest tests for parts of the temporal framework and the
R-tree ctypes bindings that no test in CI covered. The cases build their
datasets in memory, so they need neither a temporal database nor a GRASS
session.

- grass_temporal_datetime_math_test.py: datetime increment by string and
  adjustment of a datetime to a granularity.
- grass_temporal_granularity_test.py: absolute-time granularity of map
  lists of intervals, time points and a mix of both.
- grass_temporal_topology_test.py: the temporal topology builder relations
  (overlaps, overlapped, follows, precedes, contains, during) and the map
  list sorting keys. Following TemporalExtent.overlaps, an interval that
  starts and ends earlier overlaps the later one.
- grass_temporal_spatial_extent_test.py: the 2D and 3D spatial extent
  relations and intersection.
- lib_vector_rtree_ctypes_test.py: the 1D to 4D R-tree search through the
  grass.lib ctypes bindings.

These checks previously existed only in grass.temporal.unit_tests, which
could not be imported and was not run, and in doctests that CI does not
execute.

Prepared with the assistance of AI (Claude Code).
The module has been unimportable since the star imports were removed in
0c83c97: it imports adjust_datetime_to_granularity from
temporal_granularity, but that function lives in datetime_math. Nothing
imports the module, no test runner collects it (it is neither a pytest
tests/ file nor a gunittest testsuite/ file), and its own docstring calls
it deprecated, so the breakage went unnoticed for years. Sphinx autodoc
does reach it and reports the failed import as a warning.

Repairing it would mean more than fixing the import. Two assertions in
test_temporal_topology_builder expect the inverse of the current
overlaps/overlapped semantics and fail once the module can be imported
again, and the four rtree functions assert nothing at all, they only
print. The checks that remain are already covered by doctests in
datetime_math, temporal_granularity, spatial_extent and
spatio_temporal_relationships; the adjust_datetime_to_granularity
doctests are the same eleven cases the module used. Remove the module
instead of resurrecting a test nothing runs.

Drop it from the Makefile module list so it is no longer installed, and
drop the pytest ignore that only existed to step around it.

The investigation and the change were done with the help of AI
(Claude Code).
@wenzeslaus
wenzeslaus force-pushed the temporal-unit-tests-pytest-port branch from 126eb99 to b353096 Compare July 16, 2026 08:42
@wenzeslaus
wenzeslaus marked this pull request as ready for review July 16, 2026 12:34
@wenzeslaus
wenzeslaus enabled auto-merge (squash) July 16, 2026 15:15
@wenzeslaus
wenzeslaus merged commit afa4221 into OSGeo:main Jul 16, 2026
26 checks passed
@wenzeslaus
wenzeslaus deleted the temporal-unit-tests-pytest-port branch July 16, 2026 21:46
@github-actions github-actions Bot added this to the 8.6.0 milestone Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous integration libraries 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.

3 participants