From ebc5df8c4bd4c17bc0763badcef35ce208d5303e Mon Sep 17 00:00:00 2001 From: Benjamin Kircher Date: Wed, 4 May 2022 10:05:50 +0200 Subject: [PATCH] tests: Ensure load_config does not interpret file name --- tests/test_config.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_config.py b/tests/test_config.py index d6149b1..d267bee 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,4 +1,5 @@ import os.path +import shutil import pytest @@ -31,6 +32,17 @@ def test_load_config_from_yaml(): assert res[1]["name"] == "something-else" +def test_load_config_works_without_fileext(tmp_path): + """Ensure load_config does not interpret file path or file name.""" + + example_config = os.path.join(CURRENT_DIR, "example-config.yaml") + dest = tmp_path / "a" + shutil.copyfile(example_config, dest) + res = load_config(dest) + assert isinstance(res, list) + assert len(res) == 2 + + def test_load_config_handles_non_existing_file(): """ "Ensure load_config raises FileNotFoundError."""