Skip to content

Commit

Permalink
added test for invalid extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
maxfischer2781 committed Mar 23, 2021
1 parent d54f29d commit d2deb5b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cobald_tests/daemon/config/test_python.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import tempfile
import os
import pytest

from cobald.daemon.config.python import load_configuration

Expand Down Expand Up @@ -27,3 +27,12 @@ def test_load_pyconfig_many():
modules.append((ident, load_configuration(test_file.name)))
for ident, module in modules:
assert ident == module.identifier


@pytest.mark.parametrize("extension", [".pyi", ".yml", ""])
def test_load_pyconfig_invalid(extension):
with pytest.raises(ValueError):
with tempfile.NamedTemporaryFile(mode="w+", suffix=extension) as test_file:
test_file.write(module_content("'unused'"))
test_file.flush()
_ = load_configuration(test_file.name)

0 comments on commit d2deb5b

Please sign in to comment.