r.cross: migrate tests from gunittest to pytest - #7635
Conversation
Replace the gunittest testsuite with a pytest module covering the same behavior: the basic cross product (categories 0..8, no NULLs) and the -z flag case (NULL combinations dropped, categories 0..5, output has NULLs). It uses a tmp_path session fixture with synthetic 3x3 rasters and the grass.tools API.
|
Good tip, thanks. I kept it one to one with the old test here, and the single call form would make a nice follow-up cleanup. |
|
Just so you know, be nice with CI next week. There’s the community meeting where we meet up in person (arriving tomorrow), and all in the same time zone. We’ll need all available capacity, it will be our bottleneck. If there’s a specific reason to update a PR (because of semantic conflicts), it’s fine, otherwise, only when pushing actual changes. |
Understood, thanks for the heads up. I will leave the open PRs as they are and only push when there is an actual change. Enjoy the community meeting! |
|
If you have some free time during the UTC+2 time zone, there’s some ways to participate remotely too! https://grasswiki.osgeo.org/wiki/GRASS_Community_Meeting_San_Michele_2026 We can always take a little chat to discuss more advanced topics that need coordination, without having to wait back and forth too much |
|
From past years’ experience, we do get overwhelmed with notifications on GitHub, mixed with our work, helping others, and the other discussions, so you might not be forgotten if we don’t respond enough |
|
Thank you for the invitation, I would really like to join remotely. I am in IST for now, so the UTC+2 afternoon lines up with my evening, and I will follow the wiki schedule. A chat about topics that need coordination sounds great whenever it suits you. Also completely understood about the notifications, no rush from my side ever. A small piece of news: I was selected for the Apple Developer Academy in Naples, a nine month program starting this September, so I will actually be in Italy and in your time zone soon. Maybe that makes a future call or meetup easier. Enjoy San Michele! |
|
I'm rerunning the failed job, the fix for what we saw is being submitted as I write, and will be fixed now. This PR was simple to review, as it was small, isolated, and took a gunittest that didn't need the test dataset to run. So, if you want to find another one similar to that, I'd be glad to review one at a time (don't overwhelm us though) |
Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>
wenzeslaus
left a comment
There was a problem hiding this comment.
Works for me locally. I'm leaving the name as is - We are currently allowing both names (test_x and x_test with x_test being the preference at some point).
|
The still failing windows test of v.class was recently fixed in #7692, the branch needs to get updated again |
|
@echoix & @wenzeslaus Thanks for pushing this through, and for updating the branch after the Windows fix. ~ Appreciate the guidance along the way. ✨ |
Migrates r.cross's tests from gunittest to pytest, as part of the effort to support writing tests with pytest.
The new
raster/r.cross/tests/test_r_cross.pypreserves the coverage of the oldtestsuite/test_cross.py:-zflag case, where combinations containing NULL are dropped, giving categories 0..5 with NULLs in the outputIt uses a
tmp_pathsession fixture (gs.create_project+gs.setup.init) with synthetic rasters built viar.mapcalc, runs the tool throughgrass.tools.Tools, and asserts onr.describe format=json. The old gunittest testsuite is removed.Verified locally on GRASS 8.5, both tests pass. Happy to apply the same pattern to other modules if this looks like a good template.