diff --git a/kiplot/pre_erc.py b/kiplot/pre_erc.py index 73dacc26..73d28968 100644 --- a/kiplot/pre_erc.py +++ b/kiplot/pre_erc.py @@ -39,5 +39,5 @@ class Run_ERC(BasePreFlight): # noqa: F821 if ret < 0: logger.error('ERC errors: %d', -ret) else: - logger.error('ERC returned %d', ret) # pragma: no cover + logger.error('ERC returned %d', ret) exit(ERC_ERROR) diff --git a/tests/test_plot/test_preflight.py b/tests/test_plot/test_preflight.py index 973f5923..cae47636 100644 --- a/tests/test_plot/test_preflight.py +++ b/tests/test_plot/test_preflight.py @@ -23,7 +23,7 @@ if prev_dir not in sys.path: sys.path.insert(0, prev_dir) # Utils import from utils import context -from kiplot.misc import (DRC_ERROR, ERC_ERROR) +from kiplot.misc import (DRC_ERROR, ERC_ERROR, BOM_ERROR) def test_erc(): @@ -35,15 +35,24 @@ def test_erc(): ctx.clean_up() -def test_erc_fail(): +def test_erc_fail_1(): + """ Using an SCH with ERC errors """ prj = 'fail-erc' - ctx = context.TestContext('ERC', prj, 'erc', '') + ctx = context.TestContext('ERCFail1', prj, 'erc', '') ctx.run(ERC_ERROR) # Check all outputs are there ctx.expect_out_file(prj+'.erc') ctx.clean_up() +def test_erc_fail_2(): + """ Using a dummy SCH """ + prj = '3Rs' + ctx = context.TestContext('ERCFail2', prj, 'erc', '') + ctx.run(ERC_ERROR) + ctx.clean_up() + + def test_drc(): prj = 'bom' ctx = context.TestContext('DRC', prj, 'drc', '') @@ -83,6 +92,14 @@ def test_drc_error(): ctx.clean_up() +def test_drc_fail(): + """ Check we dummy PCB """ + prj = 'bom_no_xml' + ctx = context.TestContext('DRCFail', prj, 'drc', '') + ctx.run(DRC_ERROR) + ctx.clean_up() + + def test_update_xml(): prj = 'bom' ctx = context.TestContext('Update_XML', prj, 'update_xml', '') @@ -100,3 +117,11 @@ def test_update_xml(): os.remove(xml) os.rename(xml+'-bak', xml) ctx.clean_up() + + +def test_update_xml_fail(): + """ Using a dummy SCH """ + prj = '3Rs' + ctx = context.TestContext('Update_XMLFail', prj, 'update_xml', '') + ctx.run(BOM_ERROR) + ctx.clean_up() diff --git a/tests/test_plot/test_yaml_errors.py b/tests/test_plot/test_yaml_errors.py index 5a23111c..0cf7cae0 100644 --- a/tests/test_plot/test_yaml_errors.py +++ b/tests/test_plot/test_yaml_errors.py @@ -343,6 +343,14 @@ def test_error_wrong_type_3(): ctx.clean_up() +def test_error_wrong_type_4(): + """ update_xml = number """ + ctx = context.TestContext('ErrorWrongType4', PRJ, 'error_pre_wrong_type_4', '') + ctx.run(EXIT_BAD_CONFIG) + assert ctx.search_err("In preflight 'update_xml': must be boolean") + ctx.clean_up() + + def test_error_yaml(): ctx = context.TestContext('ErrorYAML', PRJ, 'error_yaml', '') ctx.run(EXIT_BAD_CONFIG) diff --git a/tests/yaml_samples/error_pre_wrong_type_4.kiplot.yaml b/tests/yaml_samples/error_pre_wrong_type_4.kiplot.yaml new file mode 100644 index 00000000..a77153a4 --- /dev/null +++ b/tests/yaml_samples/error_pre_wrong_type_4.kiplot.yaml @@ -0,0 +1,9 @@ +# Example KiPlot config file +kiplot: + version: 1 + +preflight: + update_xml: 5 + run_erc: true + +