Skip to content

r.null: migrate tests from gunittest to pytest - #7675

Merged
wenzeslaus merged 4 commits into
OSGeo:mainfrom
Valyrian-Code:r.null-pytest
Jul 12, 2026
Merged

wenzeslaus merged 4 commits into
OSGeo:mainfrom
Valyrian-Code:r.null-pytest

Conversation

@Valyrian-Code

Copy link
Copy Markdown
Contributor

Migrates the r.null testsuite from gunittest to pytest, following the r.cross migration (#7635) as suggested there. Same shape: small, isolated, and the tests create their own data, so no test dataset is needed.

The review feedback from #7635 is applied here from the start: everything goes through grass.tools (r.describe results read with .json, no gs.parse_command or env plumbing) and there is no overwrite=True, since the function-scoped fixture gives every test a fresh project.

The three checks from the old testsuite are preserved: setnull on an integer map with -i, setnull on a floating point map with -f, and filling NULL cells with null=. All three pass locally.

Copilot AI review requested due to automatic review settings July 12, 2026 14:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added raster Related to raster data processing Python Related code is in Python module tests Related to Test Suite labels Jul 12, 2026

@wenzeslaus wenzeslaus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor polish: setnull and null accept numbers, which reads a bit more naturally in Python than the string form.

Comment thread raster/r.null/tests/r_null_test.py Resolved
Comment thread raster/r.null/tests/r_null_test.py Resolved
Comment thread raster/r.null/tests/r_null_test.py Resolved
Valyrian-Code and others added 3 commits July 12, 2026 22:05
Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>
Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>
Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>
@Valyrian-Code

Copy link
Copy Markdown
Contributor Author

Minor polish: setnull and null accept numbers, which reads a bit more naturally in Python than the string form.

  • thanks! Will update it.

@wenzeslaus wenzeslaus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Thanks. Next time, try hard to criticize the changes before posting.

Here specifically, I don't recall reason for the null values to be passed as strings, but the underlying mechanism is different (SimpleModule vs Tools), so there was a reason to rethink and update.

@Valyrian-Code

Copy link
Copy Markdown
Contributor Author

Fair point, the strings were carried over from the old test without a second thought. Changed to plain numbers now. Will look harder at these next time.

@wenzeslaus
wenzeslaus enabled auto-merge (squash) July 12, 2026 17:14
@wenzeslaus

Copy link
Copy Markdown
Member

Thanks. Next time, it would good to also have a commit message ready to go, i.e. updated to correspond to the PR. We squash, so PR description is the right place (can be separate section or the desc itself). (None needed now, I already enabled automerge.)

@Valyrian-Code

Copy link
Copy Markdown
Contributor Author

Got it, I will keep the PR description in a squash ready form from now on. Thanks for enabling automerge.

@wenzeslaus
wenzeslaus merged commit 875be6b into OSGeo:main Jul 12, 2026
26 checks passed
@github-actions github-actions Bot added this to the 8.6.0 milestone Jul 12, 2026
@Valyrian-Code
Valyrian-Code deleted the r.null-pytest branch July 12, 2026 18:36
echoix pushed a commit to wenzeslaus/grass that referenced this pull request Jul 14, 2026
Migrates the r.null testsuite from gunittest to pytest. Everything goes through grass.tools (r.describe results read with .json, no gs.parse_command). The three checks from the old testsuite are preserved: setnull on an integer map with -i, setnull on a floating point map with -f, and filling NULL cells with the null parameter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants