Skip to content

Migrate g.list parameter validation tests from gunittest to pytest #7226

@Khansa435

Description

@Khansa435

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:

  1. Maintainability: The gunittest framework involves significant boilerplate and is harder to maintain than plain pytest functions.
  2. Modern Tooling: pytest allows for powerful features like parametrization, which would significantly simplify the testing of multiple flag and parameter combinations for g.list.
  3. 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions