pytest: Add very basic config to run pytest #2183
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 tests in a different style with pytest and later add functionality for easier setup or data comparison.