Skip to content

Add --region option and tests#7117

Closed
Ayush-Devs wants to merge 2 commits intoOSGeo:mainfrom
Ayush-Devs:cli-update
Closed

Add --region option and tests#7117
Ayush-Devs wants to merge 2 commits intoOSGeo:mainfrom
Ayush-Devs:cli-update

Conversation

@Ayush-Devs
Copy link

Hi maintainers,

This PR is a work-in-progress draft to improve the CLI experience for running GRASS tools. It includes the following changes:

Added --region support to the run subcommand:
Allows users to temporarily set a computational region (e.g., raster map) before running a tool.

Initial tests for subcommand_run_tool using mocks:
test_run_tool_with_region checks that g.region is called when --region is provided.
test_run_tool_without_region ensures g.region is not called when the option is omitted.
All tests mock GRASS binaries to avoid requiring a full GRASS session.

Notes / Guidance Requested.

The mocks allow the tests to run without setting up a full GRASS environment, but I’m not sure if this aligns with project standards.
Should I replace these with integration-style tests once a GRASS session is available?
Any recommendations on how to structure or extend these tests for coverage of other CLI features would be greatly appreciated.

This PR is explicitly draft/WIP; the goal is to get feedback on the approach before finalizing tests or merging.

Verified both test_run_tool_with_region and test_run_tool_without_region run successfully with mocks.
Existing CLI tests (--help, man, regular tool runs) continue to pass.

Next steps (after feedback)

Potentially add full integration tests using a live GRASS session.
Refactor mocks if needed.
Expand tests for other flags or tools in the CLI.

@github-actions github-actions bot added Python Related code is in Python libraries tests Related to Test Suite labels Feb 23, 2026
@wenzeslaus
Copy link
Member

Check with your AI or answer the questions using your own research; we won't be promting your AI for you.

@Ayush-Devs Ayush-Devs closed this Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libraries 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