[GRASS-dev] About fixing exisiting test

I have selected test_module_assertions.py and used %%python as mentioned earlier in jupyterlab notebook along with grass gis code. It ran all tests successfully but in output it says raster map not found. How to get the raster map and should i convert this code from gunitttest to pytest. How to convert it to pytest code as both are different and is there any documentation which compares gunittest and pytest. Pytest docs and gunittest docs are separate. Example for assertModule and assertModuleFail what is its equivalent in pytest. What should I do next?

(attachments)

Untitled.ipynb (6.06 KB)

If the test run okay and doesn’t fail, go ahead and create a PR to enable it.

Don’t try to convert any tests to pytest. That’s a topic for the summer. You should write a new possibly simple test using pytest.

On Sun, Apr 17, 2022, 7:30 AM Adithya Ambapurkar <adinayyu@gmail.com> wrote:

I have selected test_module_assertions.py and used %%python as mentioned earlier in jupyterlab notebook along with grass gis code. It ran all tests successfully but in output it says raster map not found. How to get the raster map and should i convert this code from gunitttest to pytest. How to convert it to pytest code as both are different and is there any documentation which compares gunittest and pytest. Pytest docs and gunittest docs are separate. Example for assertModule and assertModuleFail what is its equivalent in pytest. What should I do next?

On Sun, 17 Apr 2022 at 07:30, Adithya Ambapurkar <adinayyu@gmail.com> wrote:

…used %%python…

As I mentioned earlier, I don’t recommend this approach, but yes, you can (and have to) use this in the notebook. However, that’s for the notebook only. Unrelated to the actual test code.

It ran all tests successfully but in output it says raster map not found.

This may or may not be a problem. If the tests pass, chances are it is the correct and expected output. For example, if the test checks the behavior when a non-existent raster map is used, the message is expected and inside the test, it likely expects failure rather than success with, e.g., the assertModuleFail function you have seen.

…How to convert it to pytest code as both are different and is there any documentation which compares gunittest and pytest. Pytest docs and gunittest docs are separate. Example for assertModule and assertModuleFail what is its equivalent in pytest.

This is all for the actual summer project including the documentation.

All pytest is experimental now and does not have any documentation. However, general pytest documentation applies:

https://docs.pytest.org/