Changes between Version 3 and Version 4 of GSoC/2022


Ignore:
Timestamp:
Feb 9, 2022, 11:12:19 AM (2 years ago)
Author:
wenzeslaus
Comment:

Change grass.gunittest + GitHub Action idea to pytest

Legend:

Unmodified
Added
Removed
Modified
  • GSoC/2022

    v3 v4  
    8282
    8383
    84 === Integrate testing framework with !GitHub Actions ===
     84=== Support writing tests with pytest ===
    8585
    86 * The testing framework was written before migration to !Git/GitHub and when long free runs in 3rd party services were unthinkable. Additionally, different goals overall were prioritized.
    87 * An update is needed to reflect that tests are used to evaluate pull requests (PRs).
    88 * Most of the updates should be generic enough to integrate well with any CI environment. However, currently GRASS GIS is using !GitHub [https://github.com/OSGeo/grass/actions Actions] which open the possibility to make use of specific features there, e.g., upload artifacts for failed tests or do a quick test only of files changed in the PR.
    89 * Possibly, use //pytest// (following example of GDAL and Numpy) instead of Python unittest (some parts of grass.gunittest might be replaced by or ported to pytest).
    90 * Current tests don't accommodate well tests of the main GRASS executable (which is now more prominent also because `grass ... --exec`).
    91 * Both preserving and removing of existing HTML reporting functionality are valid options.
     86* The current testing framework, ''grass.gunittest'', was written before migration to !Git/GitHub and when long free runs in 3rd party services were unthinkable. Additionally, some no longer relevant goals were prioritized, such as independence on the current code, detailed custom HTML reports, success tracking over time, and high specialization towards GRASS-specifics.
     87* ''grass.gunittest'' is based on Python ''unittest'' package and many projects since then migrated to //pytest//, e.g., GDAL and Numpy. While ''unittest'' is inspired by Java's JUnit, ''pytest'' is designed to support writing small, readable tests, and uses plain `assert` statements instead of many different assert methods.
     88* Using ''pytest'' should lead to tests which feel more like Python scripts and to minimum of testing-specific code.
     89* An example issue of ''grass.gunittest'' is that it doesn't work well with tests of the main GRASS executable (prominence of `grass ... --exec` is yet another new thing which changed since ''grass.gunittest'' was designed).
     90* Two main things needed:
     91  - Create general comparison functions from the ''grass.gunittest'' assert methods so that they can be used with pytest.
     92  - Current grass.script.setup.init function and grass.script.core.create_location function don't work well in the context of a pytest test function. More 
     93* Additional things needed:
     94  - Fixture for pytest to set up and tear down a GRASS session in a temporary mapset.
    9295
    93 * Requirements: Python, !GitHub Actions (YAML configuration)
     96* Requirements: Python
    9497* Mentor: Vaclav Petras
    9598* Co-mentor: Stefan Blumentrath
    9699* Proposed by: Vaclav Petras
    97 * Rating: medium
    98 * Expected Outcomes: Effective reporting of test results in pull requests
     100* Rating: easy to medium
     101* Expected Outcomes: Convenient way of writing tests with pytest
    99102* Test of skills: Fix failing tests and/or write new tests (more is better). Alternatively, addressing a smaller problem in the testing framework is a good task, too.
    100 
    101103=== Improved color management in GRASS GIS ===
    102104