simpa icon indicating copy to clipboard operation
simpa copied to clipboard

Fix file_in_simpa_home test

Open faberno opened this issue 1 year ago • 0 comments

Describe the bug There are two problems with the test_instantiate_when_file_is_in_simpa_home test in test_path_manager.py:

  1. If a config in simpa_home already exists it will be used, but it's paths are compared to the generic paths defined in setUp (e.g. /workplace/data/). What should be done instead, is to hide the simpa_home_config if it exist and then create a generic simpa_home_config. When the checks are finished, the generic one is deleted and the original one restored.

  2. The Simpa Home only exists when the local source code is used and not the installed package. This makes the test fail when python -m unittest is used to run it. A workaround would be to skip this test when the simpa package is used, like this for example

pathmanager_source_file = inspect.getsourcefile(PathManager)
if "site-packages" not in pathmanager_source_file:
   # run usual test

Specify a priority (low, medium, high) low

To Reproduce cd simpa_tests python -m unittest automatic_tests/test_path_manager.py

faberno avatar May 07 '24 14:05 faberno