GRASS GSoC 2026 Support writing tests with pytest
| Student Name | Gulshan Kumar |
| Organization | NumFOCUS |
| Mentor Name | Vaclav Petras, Stefan Blumentrath |
| GitHub Fork | View Repo |
| LinkedIn Profile | View LinkedIn |
Abstract
The current test framework in GRASS, gunittest, was designed before GitHub era. Based on Python unittest, it has several distinct types of assertion methods and requires tests to be executed from within a GRASS shell session. This has steep learning curve and is far from modern testing methods which uses Pytest.
This project aims to modify the GRASS test by shifting the testing framework to pytest. Pytest uses simple and plain assert statements, fixtures, and is more readable. The project will involve designing a new API for several grass related assertions, implementing fixtures to handle GRASS sessions and temporary mapsets outside of the GRASS shell, integrating sample datasets, and iterative refactoring (utilizing tools like Bowler) to migrate existing tests. Thus, this will result in a more Pythonic, accessible, and maintainable testing environment for GRASS contributors.
Project Scope
- API Design: Designing how GRASS specific assertions (like rasterExists) will look in pytest. We will draw inspiration from NumPy/GDAL own migration history.
- Session & Mapset Fixtures: Designing pytest fixtures to handle GRASS session setup and teardown. This also include running pytest outside of a GRASS session.
- Isolation: Tests must be isolated to ensure there is no side effects between them. We will decide on per file/per function isolation.
- Sample Dataset Integration: Addressing the dependency on the NC SPM sample dataset from grass.gunittest to the pytest framework.
- Iterative Refactoring Strategy: Defining the location for the new tests (tests or testsuite directories) and utilizing AST-based refactoring tools like Bowler (combined with AI agents) to automate the migration of existing tests.
- Contributor Documentation: Creating a user friendly testing guide for future contributors to encourage rapid adoption of the new pytest framework.
Timeline
| Period | Timeline | Tasks | Status |
|---|---|---|---|
| Community Bonding Period |
May 1 - May 24, 2026 |
|
|
| Official Coding Period | |||
| Week 1 (May 25 - May 31) |
|
||
| Week 2 (June 1 - June 7) |
|
||
| Week 3 (June 8 - June 14) |
|
||
| Week 4 (June 15 - June 21) |
|
||
| Week 5 (June 22 - June 28) |
|
||
| Week 6 (June 29 - July 5) |
|
||
| Midterm Evaluation (July 6 - July 10) |
|
||
| Week 7 (July 6 - July 12) |
|
||
| Week 8 (July 13 - July 19) |
|
||
| Week 9 (July 20 - July 26) |
|
||
| Week 10 (July 27 - August 2) |
|
||
| Week 11 (August 3 - August 9) |
|
||
| Week 12 (August 10 - August 16) |
|
||
| Final Week | August 17 - August 24 |
|
Reports
Community Bonding Period
Log of Pull Requests
| PR | PR Title |
|---|---|
| #7071 | g.parser: Missing support G_OPT_F FORMAT in python %option |
| #7051 | t.vect.list: Added support for JSON, YAML and CSV |
| #7004 | grass.jupyter: use json output format in timeseriesmap |
| #6971 | db.columns: added format list and format=csV |
| #6933 | db.columns: added support for -e to print more column information |
| #6867 | v.info: Add format csv with c flag and sync with v.db.connect |
| #6823 | v.info: Sync -c flag with format=JSON output with v.db.connect |
| #6801 | v.db.connect: Ends with error if both -p and -c flags are present |
| #6728 | db.select: Adding JSON and CSV support |
| #6703 | doc: Enable MathJax rendering for equations in MkDocs documentation |