Skip to content

r.proj: replace gunittest testsuite with pytest method reference tests - #7766

Open
krcoder123 wants to merge 3 commits into
OSGeo:mainfrom
krcoder123:fix-rproj-tests
Open

r.proj: replace gunittest testsuite with pytest method reference tests#7766
krcoder123 wants to merge 3 commits into
OSGeo:mainfrom
krcoder123:fix-rproj-tests

Conversation

@krcoder123

@krcoder123 krcoder123 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

This PR replaces the r.proj gunittest testsuite with pytest. It has seven parametrized reference tests, one test for each interpolation method (nearest, bilinear, bicubic, lanczos, bilinear_f, bicubic_f, lanczos_f). It checks r.univar statistics against reference values taken from the serial module. It also has four tests for the -l and -p flags covering what the old testsuite tested there. The input is a generated 50x50 raster reprojected from EPSG:4326 into EPSG:3857.

Replace the r.proj gunittest testsuite with a pytest module of seven
parametrized reference tests, one per interpolation method (nearest,
bilinear, bicubic, lanczos, bilinear_f, bicubic_f, lanczos_f). Each runs
r.proj serially on a generated 50x50 input and checks r.univar
statistics against reference values captured from the serial r.proj
module (md5 cde07de7) at rel=1e-7; tests/conftest.py builds the source
project and input rasters.

Suggested in the review of OSGeo#7627 so the parallelization PR stays smaller
and serial regressions are caught here.

The gunittest testsuite also held four output-format tests
(test_list_output_plain, test_list_output_json, test_print_output_plain,
test_print_output_json) exercising the -l and -p flags; these are
dropped in the migration and not reproduced in pytest.
@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 23, 2026
Comment thread raster/r.proj/tests/conftest.py Outdated
@@ -0,0 +1,75 @@
"""Fixtures for the r.proj parallel-correctness pytest.

Builds one GISDBASE holding an EPSG:4326 source project with two small

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is way too long. Keep it short, as if you would write it without AI.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I reduced the conftest docstring size and cleaned up the comments. I also added some of the tests that were missing from this PR but were in the old testsuite. Please let me know if this looks good now, thanks.

The method reference test carried its provenance and tolerance reasoning in a
long docstring and an inline comment. That kind of background belongs in the
history, so it lives here now and the test file stays short.

The reference statistics come from the serial r.proj on the main branch, run
single-threaded on the input_mid fixture. The seven methods each produce
distinct numbers, and the fixture is curved enough that mixing up any two of
them, including the fallback variants, shows up in the statistics the test
checks.
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