Repository navigation
r.support: add coverage for metadata, history and null-file flags - #7863
Merged
Merged
Conversation
Cover the same four cases as the gunittest testsuite: setting and removing a semantic label at once fails, an over-long label is rejected, r.support assigns the semantic label, and the -b flag clears it. Uses a tmp_path session fixture with a synthetic raster and reads the label back via r.info format=json instead of the ctypes library bindings.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
test_semantic_label_and_removal_are_exclusive used tools without creating it in the test, which flake8 flags as F821 and which raises NameError at run time.
There was a problem hiding this comment.
Pull request overview
This PR expands automated pytest coverage for r.support to include additional metadata fields, history import/export behaviors, and null-file maintenance flags, as a follow-up to prior migration work.
Changes:
- Adds pytest tests validating metadata fields (title, units, vdatum, sources, description) via r.info JSON output.
- Adds tests for history behaviors: append semantics, savehistory export, and loadhistory restore/replace semantics.
- Adds tests covering null-file maintenance flags -n (reset) and -d (delete) using r.univar null cell counts, and removes the legacy gunittest testsuite file.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| raster/r.support/testsuite/test_r_support.py | Removes legacy gunittest-based semantic label tests (superseded by pytest coverage). |
| raster/r.support/tests/r_support_test.py | Adds pytest coverage for metadata fields, history behaviors, and null-file flags in r.support. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Member
|
@Valyrian-Code Solve conflicts please ;) |
…rage # Conflicts: # raster/r.support/tests/r_support_test.py
Contributor
Author
|
Merged main now that #7821 landed, this PR is just the 5 new tests on top of it. |
echoix
previously approved these changes
Sep 10, 2026
.strip() masked the trailing newline savehistory writes after each history line (main.c fprintf(fp, "%s\n", ...)), so the test would not notice extra blank lines or other whitespace regressions in the output file. Assert the exact expected content instead.
ninsbl
previously approved these changes
Sep 14, 2026
Contributor
Author
petrasovaa
reviewed
Sep 23, 2026
Co-authored-by: Anna Petrasova <kratochanna@gmail.com>
petrasovaa
approved these changes
Sep 23, 2026
petrasovaa
enabled auto-merge (squash)
September 23, 2026 02:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #7821, adding coverage for the rest of r.support per the review there. This is stacked on #7821 and should be merged after it (the diff below will settle once that one lands).
Adds tests for:
Not covered: the -s flag (update statistics). Every normal write path (r.mapcalc, r.in.ascii, ...) already computes correct range/stats on write, so producing a genuinely stale range to verify -s fixing it would need writing raw cell data below the normal API, which felt too fragile for this PR. Happy to revisit if there's a clean way to do it.
Verified locally, all 9 tests pass.