From b3811b78cc8fe1483e9e7be813462b896bd8d472 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Sat, 1 Aug 2020 14:36:21 -0300 Subject: [PATCH] Added test for `use_alt` internal BoM option --- tests/test_plot/test_int_bom.py | 16 ++++++++++++++++ tests/yaml_samples/int_bom_use_alt.kiplot.yaml | 13 +++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 tests/yaml_samples/int_bom_use_alt.kiplot.yaml diff --git a/tests/test_plot/test_int_bom.py b/tests/test_plot/test_int_bom.py index 99ae55db..3abc35ff 100644 --- a/tests/test_plot/test_int_bom.py +++ b/tests/test_plot/test_int_bom.py @@ -28,6 +28,7 @@ COMP_COLUMN_NAME = 'Component' KIBOM_TEST_HEAD = [COMP_COLUMN_NAME , 'Description', 'Part', REF_COLUMN_NAME, 'Value', 'Footprint', QTY_COLUMN_NAME, 'Datasheet', 'Config'] KIBOM_TEST_COMPONENTS = ['C1', 'C2', 'C3', 'C4', 'R1', 'R2', 'R3', 'R4', 'R5', 'R7', 'R8', 'R9', 'R10'] +KIBOM_TEST_COMPONENTS_ALT = ['C1-C4', 'R9-R10', 'R7', 'R8', 'R1-R5'] KIBOM_TEST_EXCLUDE = ['R6'] KIBOM_TEST_GROUPS = 5 @@ -296,3 +297,18 @@ def test_int_bom_html_generate_dnf(): check_dnc(rows[0], 'R7', ref_column, qty_column) ctx.clean_up() + +def test_int_bom_use_alt(): + prj = 'kibom-test' + ext = 'csv' + ctx = context.TestContextSCH('test_int_bom_use_alt', prj, 'int_bom_use_alt', BOM_DIR) + ctx.run() + out = prj + '-bom.' + ext + rows, header = ctx.load_csv(out) + assert header == KIBOM_TEST_HEAD + ref_column = header.index(REF_COLUMN_NAME) + qty_column = header.index(QTY_COLUMN_NAME) + check_kibom_test_netlist(rows, ref_column, KIBOM_TEST_GROUPS, KIBOM_TEST_EXCLUDE, KIBOM_TEST_COMPONENTS_ALT) + check_dnc(rows, 'R7', ref_column, qty_column) + ctx.clean_up() + diff --git a/tests/yaml_samples/int_bom_use_alt.kiplot.yaml b/tests/yaml_samples/int_bom_use_alt.kiplot.yaml new file mode 100644 index 00000000..fc43690d --- /dev/null +++ b/tests/yaml_samples/int_bom_use_alt.kiplot.yaml @@ -0,0 +1,13 @@ +# Example KiPlot config file +kiplot: + version: 1 + +outputs: + - name: 'bom_internal' + comment: "Bill of Materials in CSV format" + type: bom + dir: BoM + options: + use_alt: true + format: CSV +