diff options
Diffstat (limited to 'tests/unit/test_config_file.py')
-rw-r--r-- | tests/unit/test_config_file.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/unit/test_config_file.py b/tests/unit/test_config_file.py new file mode 100644 index 00000000..04766f4a --- /dev/null +++ b/tests/unit/test_config_file.py @@ -0,0 +1,22 @@ +import pytest +import os + +from jrnl.install import find_alt_config + + +def test_find_alt_config(request): + work_config_path = os.path.join( + request.fspath.dirname, "..", "data", "configs", "basic_onefile.yaml" + ) + found_alt_config = find_alt_config(work_config_path) + assert found_alt_config == work_config_path + + +def test_find_alt_config_not_exist(request): + bad_config_path = os.path.join( + request.fspath.dirname, "..", "data", "configs", "not-existing-config.yaml" + ) + with pytest.raises(SystemExit) as ex: + found_alt_config = find_alt_config(bad_config_path) + assert found_alt_config is not None + assert isinstance(ex.value, SystemExit) |