hutschen / mv-tool-api

Measure tracking tool for the implementation of information security measures in projects
https://mv-tool.readthedocs.io
GNU Affero General Public License v3.0
2 stars 0 forks source link

Pytest tests should run without config.yml #139

Open hutschen opened 1 year ago

hutschen commented 1 year ago

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.