Tests in examples_test.py
fail when run from outside the test
dir
#474
Labels
examples_test.py
fail when run from outside the test
dir
#474
The issue doesn't affect the CI since examples are excluded.
These tests need to be run from within
/path/to/mala/test/
because (i) of the usage of relative paths inrunpy.run_path()
and (ii) since all examples save their artifacts to a relative path, so when run fromthose will end up there. Also examples expect artifacts which they read, such as "be_model.zip", to be in the dir where the script is executed in. An obvious fix to allow running
pytest
from anywhere, in particular from the package root dir, is to use absolute paths. Then we pollute this dir with artifacts but can clean that with running/path/to/mala/test/clean.sh
in the package root. However, a more clean way would be:tempfile.TemporaryDirectory
orpytest
toolingSee e.g. here for a possible way to do it.
The text was updated successfully, but these errors were encountered: