r.support: add coverage for metadata, history and null-file flags - #7863
Open
Valyrian-Code wants to merge 7 commits into
Open
r.support: add coverage for metadata, history and null-file flags#7863Valyrian-Code wants to merge 7 commits into
Valyrian-Code wants to merge 7 commits into
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.
|
|
||
| history_file = tmp_path / "history.txt" | ||
| tools.r_support(map="test", savehistory=str(history_file)) | ||
| assert history_file.read_text().strip() == expected |
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. |
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.