The config.yml is read out in mvtool/__init__.py. This means that config.yml is automatically accessed each time mvtool is imported. The pytests import the mvtool package. For this reason, the config.yml is required for testing and the following error occurs if the tests are run without this file.
ImportError while loading conftest '/home/runner/work/mv-tool-api/mv-tool-api/tests/conftest.py'.
tests/conftest.py:25: in <module>
from mvtool import database
mvtool/__init__.py:36: in <module>
config = load_config()
mvtool/config.py:111: in load_config
with open(_to_abs_filename(CONFIG_FILENAME), "r") as config_file:
E FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/mv-tool-api/mv-tool-api/config.yml'
Error: Process completed with exit code 4.
The code must be changed so that the tests can be run without config.yml.
The
config.yml
is read out inmvtool/__init__.py
. This means thatconfig.yml
is automatically accessed each timemvtool
is imported. The pytests import themvtool
package. For this reason, theconfig.yml
is required for testing and the following error occurs if the tests are run without this file.The code must be changed so that the tests can be run without
config.yml
.