Open-EO / openeo-gfmap

Generic framework for EO mapping applications building on openEO
Apache License 2.0
4 stars 0 forks source link

download in tests: use tmp_path fixture instead of downloading to repo #32

Open soxofaan opened 5 months ago

soxofaan commented 5 months ago

This is a pattern I've noticed in various tests: https://github.com/Open-EO/openeo-gfmap/blob/4dbc338c41dc5f6e46b51a70bb365f1bb5c353d9/tests/test_openeo_gfmap/test_cloud_masking.py#L75-L77

Downloading test results to the repo tree (e.g. through building a path from __file__) is a practice to be avoided as it can cause various problems (accidentally committing test results, problems with concurrent test runs, confusion with leftovers that are note cleaned up, ...)

It's recommended to use the tmp_path fixture of pytest instead, which will automatically provide a pristine word directory: https://docs.pytest.org/en/7.1.x/how-to/tmp_path.html