Skip to content

tools: implement dynamic jupyter utils tests using session_with_data#7209

Open
AkshadSonawane wants to merge 1 commit intoOSGeo:mainfrom
AkshadSonawane:tests/get-region-integration
Open

tools: implement dynamic jupyter utils tests using session_with_data#7209
AkshadSonawane wants to merge 1 commit intoOSGeo:mainfrom
AkshadSonawane:tests/get-region-integration

Conversation

@AkshadSonawane
Copy link
Copy Markdown

@AkshadSonawane AkshadSonawane commented Mar 22, 2026

Reopening and updating after feedback on #7198.

Updates in this iteration

  • Refactored repeated logic from mapping classes into a centralized utils.py.
  • Reworked the testing approach to use the session_with_data fixture instead of mocks or hardcoded values.
  • test_get_region now dynamically validates output against the native backend (gs.region()), so it works consistently both locally and with the CI North Carolina dataset.
  • Added parametrized tests for display command parsing using @pytest.mark.parametrize.
  • All tests are passing cleanly against a compiled GRASS 8.6.0dev build.

Local test run

Screenshot 2026-03-27 015513

@petrasovaa
Copy link
Copy Markdown
Contributor

This is an overkill for one simple function. The test file could cover all the functions in utils. You can use session_with_data and test the actual values. What is the integration mark for?

@AkshadSonawane AkshadSonawane force-pushed the tests/get-region-integration branch from 7308409 to 686ee28 Compare March 26, 2026 20:38
@AkshadSonawane
Copy link
Copy Markdown
Author

This is an overkill for one simple function. The test file could cover all the functions in utils. You can use session_with_data and test the actual values. What is the integration mark for?

@petrasovaa
I've force-pushed an updated version of this PR based on your feedback.

The logic is now centralized in utils.py, and tests use the session_with_data fixture instead of hardcoded values, making them compatible with both local setups and CI.

I've also updated the PR description and included a clean test run.

Looking forward to your feedback!

@AkshadSonawane AkshadSonawane force-pushed the tests/get-region-integration branch 4 times, most recently from db0850e to 5b8c2df Compare March 26, 2026 22:42
@AkshadSonawane AkshadSonawane force-pushed the tests/get-region-integration branch from 5b8c2df to 797583f Compare March 26, 2026 22:46
@AkshadSonawane AkshadSonawane changed the title tests: add integration tests for get_region in grass.jupyter test(jupyter): implement dynamic utils tests using session_with_data fixture Mar 27, 2026
@AkshadSonawane AkshadSonawane changed the title test(jupyter): implement dynamic utils tests using session_with_data fixture tools: implement dynamic jupyter utils tests using session_with_data Mar 27, 2026
@AkshadSonawane
Copy link
Copy Markdown
Author

Hi @petrasovaa,

Working on this PR along with #7207 gave me a good understanding of both the session_with_data testing approach and the Tools API changes.

As a next step, I’m interested in applying this testing strategy to the higher-level rendering classes in grass.jupyter (like InteractiveMap and SeriesMap), which currently lack dynamic test coverage. This is also something I’m considering exploring further in my proposal.

I’m planning to prototype this for InteractiveMap. Does this sound like a useful direction?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libraries notebook Python Related code is in Python tests Related to Test Suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants