CABLE-LSM / benchcab

Tool for evaluation of CABLE land surface model
https://benchcab.readthedocs.io/en/latest/
Apache License 2.0
2 stars 4 forks source link

`pytest` temporary test directory should use `__file__` #26

Closed SeanBryan51 closed 1 year ago

SeanBryan51 commented 1 year ago

Currently, we can only run pytest from the project root directory so that TMP_DIR is a valid path to the temporary test directory: https://github.com/CABLE-LSM/benchcab/blob/f7ba1f076f54750aade09686de48aefdaea44b45/tests/common.py#L3-L5 https://github.com/CABLE-LSM/benchcab/blob/f7ba1f076f54750aade09686de48aefdaea44b45/tests/test_task.py#L22-L27

Instead of using the current working directory, we should use __file__ to get the temporary test directory so that pytest runs correctly from any directory.

ccarouge commented 1 year ago

Won't it give permission issues if we run the tests on a central installation of benchcab? Would it be better to create TMP_DIR under $TMPDIR instead of cwd ? And then maybe the path could be benchcab_tests instead of tests/tmp.

SeanBryan51 commented 1 year ago

Good point, using $TMPDIR is probably the right way to do it