Skip to content

Test: add test for utils.py funcions.#7052

Open
ayushjariyal wants to merge 4 commits intoOSGeo:mainfrom
ayushjariyal:test_for_utils
Open

Test: add test for utils.py funcions.#7052
ayushjariyal wants to merge 4 commits intoOSGeo:mainfrom
ayushjariyal:test_for_utils

Conversation

@ayushjariyal
Copy link
Contributor

I noticed that there is no test for utils.py file in grass/jupyter/test directory.
so, In this PR, I add tests for get_region and get_location_proj_string function of utils.py file.
I verify these test by locally running pytest

image

@github-actions github-actions bot added Python Related code is in Python libraries tests Related to Test Suite notebook labels Feb 7, 2026
@ayushjariyal
Copy link
Contributor Author

@petrasovaa, I am not able to change the title of this PR. could you please do that so that it can pass the test and please review this PR.

@ayushjariyal
Copy link
Contributor Author

@petrasovaa, It looks like pytest is failing because these tests require an active GRASS session. Locally they pass when run inside a GRASS session, but in CI, the session does not seem to be initialized.
Could you please let me know whether this is a CI setup issue or something caused by my changes?

@gulshan-123
Copy link
Contributor

i believe you should use something like this (see conftest.py under tests):

with gs.setup.init(project):
      ....

Basically, gs.setup.init starts the session.

Also, to check whether this succeeds or not, I run the pytest in linux terminal (not in the grass terminal).
For this, you may have to do:

make

Then note the output of ./bin.x86_64-pc-linux-gnu/grass --config python_path
export PYTHONPATH=$PYTHONPATH:<Output Of Above>

Now run pytest to see if it succeeds...

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