Problem Description
The GRASS GIS project is currently in the process of migrating its testing framework from the legacy grass.gunittest (based on Python's unittest) to the modern pytest framework.
Currently, many core modules still have their validation logic tests residing in the legacy testsuite/ directories. Specifically, the g.list module has several critical parameter validation tests (such as checking for mutually exclusive flags) that have not yet been migrated to the modern tests/ directory.
Rationale
Migrating these tests to pytest is necessary because:
- Maintainability: The
gunittest framework involves significant boilerplate and is harder to maintain than plain pytest functions.
- Modern Tooling:
pytest allows for powerful features like parametrization, which would significantly simplify the testing of multiple flag and parameter combinations for g.list.
- Consistency: Moving all tests to the tests/ directory provides a unified testing interface for the entire repository.
Expectations
- The logic within GMlistWrongParamertersTest (found in general/g.list/testsuite/test_g_list.py) should be ported to a
pytest-compatible format.
- The new tests should be integrated into general/g.list/tests/g_list_test.py.
- Validation should utilize modern
pytest features, such as @pytest.mark.parametrize for flag combinations and pytest.raises for error handling.
- The migrated tests must be verified to pass in standard environments, including Windows (OSGeo4W).
Problem Description
The GRASS GIS project is currently in the process of migrating its testing framework from the legacy
grass.gunittest(based on Python's unittest) to the modernpytestframework.Currently, many core modules still have their validation logic tests residing in the legacy
testsuite/directories. Specifically, theg.listmodule has several critical parameter validation tests (such as checking for mutually exclusive flags) that have not yet been migrated to the modern tests/ directory.Rationale
Migrating these tests to
pytestis necessary because:gunittestframework involves significant boilerplate and is harder to maintain than plainpytestfunctions.pytestallows for powerful features like parametrization, which would significantly simplify the testing of multiple flag and parameter combinations forg.list.Expectations
pytest-compatible format.pytestfeatures, such as@pytest.mark.parametrizefor flag combinations andpytest.raisesfor error handling.