[GRASS-git] [OSGeo/grass] 924db5: pytest: Add very basic config to run pytest (#2183)

Vaclav Petras noreply at github.com
Tue Feb 8 18:20:48 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: 924db551b54047a2875781ba7ba6abd8b0813a2a
      https://github.com/OSGeo/grass/commit/924db551b54047a2875781ba7ba6abd8b0813a2a
  Author: Vaclav Petras <wenzeslaus at gmail.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    A .github/workflows/pytest.yml
    A .github/workflows/python_apt.txt
    A .github/workflows/python_requirements.txt
    M pyproject.toml
    A python/grass/script/tests/utils_test.py

  Log Message:
  -----------
  pytest: Add very basic config to run pytest (#2183)

This adds pytest configuration and one pytest-ready test file so that pytest can run on the source code without errors.

Notably, this does not use or run any of the existing tests and searches for tests in directories called tests (instead of testsuite).

There is no handling of GRASS session or any test data. Each test needs to set up the session by itself.

However, given that the test assume import grass will work, the command 'pytest .' will work without errors only when Python path (PYTHONPATH) is set beforehand. (The CI is using 'grass --config ...' to get it.)

The idea is to allow for writing of tests in a different style with pytest and later add functionality for easier setup or data comparison.




More information about the grass-commit mailing list