| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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.
There was a problem hiding this comment.
This PR migrates r.support’s semantic label handling tests from the legacy gunittest framework to pytest, aligning the module with the project-wide move toward pytest-based testing.
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 the previous gunittest-based semantic label tests. |
| raster/r.support/tests/r_support_test.py | Adds pytest-based semantic label tests using a tmp_path-backed session and JSON metadata checks. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Sorry, something went wrong.
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.
|
Dropped overwrite=True from the fixture, it was not needed. The fixture creates a fresh project each time, so there is no map to collide with. |
Sorry, something went wrong.
|
Added the SPDX-License-Identifier header here too, same tip from #7822. |
Sorry, something went wrong.
|
While this technically ports the test, the test itself lacks tests for a lot of functionality, see e.g.: |
Sorry, something went wrong.
I'd still merge the existing tests as is and review what changed after. But it's personal preference matter, as it makes less to check than a whole new file to add |
Sorry, something went wrong.
|
Good point, thanks. Let's go with your suggestion, merge this as is and I'll open a follow-up PR that adds coverage for the other options (title, history, units, vdatum, source1/source2, description, loadhistory/savehistory). |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Migrates r.support's tests from gunittest to pytest, part of the effort to support writing tests with pytest.
The new raster/r.support/tests/r_support_test.py keeps the same four cases as the old testsuite/test_r_support.py:
It uses a tmp_path session fixture with a synthetic single-cell raster, and reads the label back via r.info format=json rather than the ctypes grass.lib bindings the old test used. Verified locally on GRASS 8.5, all four pass.