diff --git a/tests/test_plot/test_yaml_errors.py b/tests/test_plot/test_yaml_errors.py new file mode 100644 index 00000000..40fdb39c --- /dev/null +++ b/tests/test_plot/test_yaml_errors.py @@ -0,0 +1,26 @@ +""" +Tests various errors in the config file + +- No kiplot.version +- Wrong kiplot.version + +For debug information use: +pytest-3 --log-cli-level debug +""" + +import os +import sys +# Look for the 'utils' module from where the script is running +prev_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.dirname(prev_dir)) +# Utils import +from utils import context +sys.path.insert(0, os.path.dirname(prev_dir)) +from kiplot.misc import (EXIT_BAD_CONFIG) + + +def test_no_version(): + ctx = context.TestContext('ErrorNoVersion', '3Rs', 'error_no_version', None) + ctx.run(EXIT_BAD_CONFIG) + assert ctx.search_err('YAML config needs kiplot.version') + ctx.clean_up() diff --git a/tests/yaml_samples/error_no_version.kiplot.yaml b/tests/yaml_samples/error_no_version.kiplot.yaml new file mode 100644 index 00000000..3d9494d0 --- /dev/null +++ b/tests/yaml_samples/error_no_version.kiplot.yaml @@ -0,0 +1,4 @@ +preflight: + run_drc: true + +