grass.script: Pass env to debug_level#5920
Merged
wenzeslaus merged 2 commits intoOSGeo:mainfrom Jun 20, 2025
Merged
Conversation
To get a debug level Python code calls debug_level function which in turn needs to call g.gisenv because the debug level is stored in GRASS gisenv variable (and not as a system environment variable). For call to g.gisenv, one needs to have a session (GISRC) set up, so env is needed when it is only a local one (and not os.environ). Experimentally, this also removes the monkeypatch fixture from the recently added test for g.list which, without the monkeypatch, failed on Windows with GISRC missing from g.gisenv indicating that os.environ was set up with the runtime (PATH etc.), but didn't have an active session (GISRC etc.). This should pass the correct local environment through env all the way to g.gisenv. (Additionally, the fixture scope is changed to module, so that it is created only once.)
Member
|
Looks promising |
Co-authored-by: Edouard Choinière <[email protected]>
petrasovaa
approved these changes
Jun 20, 2025
Member
Author
|
The g.list test without monkeypatch runs, so I'm keeping the change there. Let's merge this. |
Member
Great! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To get a debug level Python code calls debug_level function which in turn needs to call g.gisenv because the debug level is stored in GRASS gisenv variable (and not as a system environment variable). For call to g.gisenv, one needs to have a session (GISRC) set up, so env is needed when it is only a local one (and not os.environ).
Experimentally, this also removes the monkeypatch fixture from the recently added test for g.list which, without the monkeypatch, failed on Windows with GISRC missing from g.gisenv indicating that os.environ was set up with the runtime (PATH etc.), but didn't have an active session (GISRC etc.). This should pass the correct local environment through env all the way to g.gisenv. (Additionally, the fixture scope is changed to module, so that it is created only once.)