Repository navigation
tests: Un-shadow duplicated test method names in r.random and t.rast.gapfill - #7911
Merged
Merged
Conversation
Two gunittest classes define the same test method name twice, so the
earlier definition is overwritten at class-body execution time and never
collected.
raster/r.random: test_random_raster_flag_z and test_vector_random_flag_z
are each defined twice. The first pair writes the "_null" outputs that
tearDownClass already cleans up and is documented as "( with NULL values
)", so it belongs to the -n flag ("Generate points also for NULL cells"),
not -z. Rename it to *_flag_n and pass flags="n". 8 -> 10 collected tests.
temporal/t.rast.gapfill: test_simple_gran is defined twice; the second
passes suffix="time", so name it test_simple_gran_time_suffix, matching
the convention used by t.rast.neighbors and t.rast.accumulate. This
restores the default-suffix test. 5 -> 6 collected tests.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Member
|
Claude is able and can build grass to run these checks, everything is already in the Claude docs, it works for me. Just insist. |
This comment has been minimized.
This comment has been minimized.
echoix
approved these changes
Sep 18, 2026
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.
Two gunittest classes define the same test method name twice. Python binds the
second
defover the first while executing the class body, so the earlier testis gone before
unittestever looks at the class — it is never collected andnever run.
raster/r.random/testsuite/test_r_random.pytest_random_raster_flag_z(line 86) andtest_vector_random_flag_z(line 101)are redefined at lines 154 and 169.
The shadowed pair is the one that writes the
_nulloutputs and is documented as# check if random raster ( with NULL values ) was created. Those are exactlythe maps
tearDownClassalready cleans up:-zis "Generate vector points as 3D points" and is already covered by thesurviving pair (which writes
_3D). The NULL behaviour is-n,"Generate points also for NULL cells" (
raster/r.random/main.c,flag.zero).So the shadowed pair is renamed to
test_random_raster_flag_n/test_vector_random_flag_nand passesflags="n".temporal/t.rast.gapfill/testsuite/test_gapfill.pytest_simple_gran(line 256) is redefined at line 301. The second copy passessuffix="time"and asserts thetest_2001_02_01T00_00_00naming, so it isrenamed
test_simple_gran_time_suffix— matching the convention int.rast.neighborsandt.rast.accumulate. That restores the default (gran)suffix test, which asserts the
test_2001_02naming.setUp/tearDownrecreate and drop theAstrds per test, so the two now runindependently.
Effect
Importing each module with
grass.*stubbed and counting the collectedtest_*attributes:I do not have a GRASS build here, so the newly collected tests have not been
executed locally — the Ubuntu gunittest job is the real check on this PR.
One pre-existing nit left alone:
test_random_raster_flag_n,_flag_band_flag_zall assertassertRasterExists(self.raster)while theirmsg=namesthe suffixed map. Tightening those three is a separate cleanup; say the word and
I will fold it in.
AI-assisted (the shadowing was surfaced by an AST sweep; the
-nvs-zreasoning and the diff are mine after reading
main.cand the teardown list).🤖 Generated with Claude Code