Hi @neteler @annakrat and GRASS Developers
I’ve been working on the pytest migration project and wanted to share my initial contribution and get feedback.
## What I’ve Done
I created pytest-compatible comparison utilities to help migrate from gunittest:
**Key additions:**
1. `grass.script.pytest_utils` module with comparison functions:
- [raster_fits_univar()](cci:1://file:///c:/Users/HP/Desktop/OSgeo/grass/python/grass/script/pytest_utils.py:22:0-73:19) - Check raster statistics
- [raster_exists()](cci:1://file:///c:/Users/HP/Desktop/OSgeo/grass/python/grass/script/pytest_utils.py:76:0-101:59) - Verify raster existence
- [vector_exists()](cci:1://file:///c:/Users/HP/Desktop/OSgeo/grass/python/grass/script/pytest_utils.py:104:0-129:59) - Verify vector existence
- [module_succeeds()](cci:1://file:///c:/Users/HP/Desktop/OSgeo/grass/python/grass/script/pytest_utils.py:132:0-159:56) - Test module execution
2. Example tests demonstrating pytest best practices
## Why This Matters
Currently, gunittest assertions like `assertRasterFitsUnivar()` are tightly coupled to TestCase classes. This creates several issues:
- Cannot use with pytest
- Not reusable in scripts/notebooks
- Blocks migration to pytest
The new utilities work with plain `assert` statements:
```python
# Old gunittest way
self.assertRasterFitsUnivar(“map”, {“mean”: 5.0})
# New pytest way
matches, msg = raster_fits_univar(“map”, {“mean”: 5.0})
assert matches, msg
I’d appreciate feedback on the approach!
regards Saurabh Singh