diff --git a/tests/board_samples/error_eof.sch b/tests/board_samples/error_eof.sch new file mode 100644 index 00000000..6bad8910 --- /dev/null +++ b/tests/board_samples/error_eof.sch @@ -0,0 +1,16 @@ +EESchema Schematic File Version 4 +EELAYER 30 0 +EELAYER END +$Descr A4 11693 8268 +encoding utf-8 +Sheet 1 1 +Title "" +Date "" +Rev "" +Comp "" +Comment1 "" +Comment2 "" +Comment3 "" +Comment4 "" +$EndDescr +$Comp diff --git a/tests/board_samples/error_no_eelayer.sch b/tests/board_samples/error_no_eelayer.sch new file mode 100644 index 00000000..c238272c --- /dev/null +++ b/tests/board_samples/error_no_eelayer.sch @@ -0,0 +1,3 @@ +EESchema Schematic File Version 4 +EELAYER END + diff --git a/tests/board_samples/error_no_eelayer_end.sch b/tests/board_samples/error_no_eelayer_end.sch new file mode 100644 index 00000000..e7282ddb --- /dev/null +++ b/tests/board_samples/error_no_eelayer_end.sch @@ -0,0 +1,4 @@ +EESchema Schematic File Version 4 +EELAYER 30 0 +$Descr A4 11693 8268 + diff --git a/tests/board_samples/error_unknown_def.sch b/tests/board_samples/error_unknown_def.sch new file mode 100644 index 00000000..8ac97a82 --- /dev/null +++ b/tests/board_samples/error_unknown_def.sch @@ -0,0 +1,17 @@ +EESchema Schematic File Version 4 +EELAYER 30 0 +EELAYER END +$Descr A4 11693 8268 +encoding utf-8 +Sheet 1 1 +Title "" +Date "" +Rev "" +Comp "" +Comment1 "" +Comment2 "" +Comment3 "" +Comment4 "" +$EndDescr +$Cito + diff --git a/tests/test_plot/test_sch_errors.py b/tests/test_plot/test_sch_errors.py new file mode 100644 index 00000000..3e030a36 --- /dev/null +++ b/tests/test_plot/test_sch_errors.py @@ -0,0 +1,49 @@ +""" +Tests SCH errors + + +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 CORRUPTED_SCH + + +def setup_ctx(test, file, error): + test = 'sch_errors_'+test + ctx = context.TestContextSCH('test_'+test, file, 'int_bom_simple_csv', None) + ctx.run(CORRUPTED_SCH) + ctx.search_err(error) + ctx.clean_up() + + +def test_sch_errors_no_signature(): + setup_ctx('no_signature', '3Rs', 'No eeschema signature') + + +def test_sch_errors_no_eelayer(): + setup_ctx('no_eelayer', 'error_no_eelayer', 'Missing EELAYER') + + +def test_sch_errors_no_eelayer_end(): + setup_ctx('no_eelayer_end', 'error_no_eelayer_end', 'Missing EELAYER END') + + +def test_sch_errors_unknown_def(): + setup_ctx('unknown_def', 'error_unknown_def', 'Unknown definition') + + +def test_sch_errors_eof(): + setup_ctx('eof', 'error_eof', 'Unexpected end of file') + + + +