Skip to content

tests: add pytest for get_region in grass.jupyter#7180

Open
AkshadSonawane wants to merge 5 commits intoOSGeo:mainfrom
AkshadSonawane:add-jupyter-region-test
Open

tests: add pytest for get_region in grass.jupyter#7180
AkshadSonawane wants to merge 5 commits intoOSGeo:mainfrom
AkshadSonawane:add-jupyter-region-test

Conversation

@AkshadSonawane
Copy link

@AkshadSonawane AkshadSonawane commented Mar 14, 2026

Add unit test for 'get_region' in Jupyter utils

1. What I Did & Why :

Hey everyone! This PR adds a quick unit test for the 'get_region' function over in 'grass.jupyter.utils'.

To keep the tests fast and avoid needing a live GRASS session, I used 'pytest' and 'unittest.mock.patch' to mock the 'Tools' class. This simulates 'g.region' returning some dummy data. It basically just verifies that the utility is correctly parsing the geographic data into a standard Python dictionary.

Mainly doing this to help improve the test coverage for the Python toolset!

2. Results :

Everything isolates properly and passes cleanly on my end without errors.

OUTPUT: Screenshot 2026-03-14 180318

3. Intention :

On a personal note, I'm submitting this as part of my preparation for GSoC 2026. I'm aiming for the "Improve GRASS user experience in Jupyter Notebook" project. Since I'm focusing my core contributions around Python and data science libraries, I'd absolutely love any feedback from the maintainers on my testing approach here. I just want to make sure my code aligns with the project's standards before I put my final proposal together. Thanks!

@github-actions github-actions bot added Python Related code is in Python libraries notebook labels Mar 14, 2026
@AkshadSonawane AkshadSonawane changed the title test: add pytest for get_region in grass.jupyter tests: add pytest for get_region in grass.jupyter Mar 14, 2026
@AkshadSonawane AkshadSonawane force-pushed the add-jupyter-region-test branch from fef7f9d to 95b05e3 Compare March 14, 2026 20:20
echoix and others added 2 commits March 14, 2026 18:10
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants