From 9c8830eefa7cb08e74dd27273a7eb7ef6d1788a3 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Sat, 1 Aug 2020 16:07:51 -0300 Subject: [PATCH] Added test for the connectors grouping. --- tests/board_samples/connectors.sch | 64 +++++++++++++++++++ tests/test_plot/test_int_bom.py | 28 ++++++++ .../int_bom_no_group_connectors.kiplot.yaml | 13 ++++ 3 files changed, 105 insertions(+) create mode 100644 tests/board_samples/connectors.sch create mode 100644 tests/yaml_samples/int_bom_no_group_connectors.kiplot.yaml diff --git a/tests/board_samples/connectors.sch b/tests/board_samples/connectors.sch new file mode 100644 index 00000000..d0376a7a --- /dev/null +++ b/tests/board_samples/connectors.sch @@ -0,0 +1,64 @@ +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 +L Connector:Conn_01x06_Male J1 +U 1 1 5F170FD6 +P 2950 2150 +F 0 "J1" H 3058 2531 50 0000 C CNN +F 1 "Bizarre Bus" H 3058 2440 50 0000 C CNN +F 2 "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical" H 2950 2150 50 0001 C CNN +F 3 "~" H 2950 2150 50 0001 C CNN +F 4 "1x6" H 2950 2150 50 0001 C CNN "Description" + 1 2950 2150 + 1 0 0 -1 +$EndComp +$Comp +L Connector:Conn_01x06_Male J2 +U 1 1 5F1718A4 +P 3850 2150 +F 0 "J2" H 3958 2531 50 0000 C CNN +F 1 "Output crazy" H 3958 2440 50 0000 C CNN +F 2 "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical" H 3850 2150 50 0001 C CNN +F 3 "~" H 3850 2150 50 0001 C CNN +F 4 "1x6" H 3850 2150 50 0001 C CNN "Description" + 1 3850 2150 + 1 0 0 -1 +$EndComp +$Comp +L Connector:Conn_01x04_Female J4 +U 1 1 5F172308 +P 4050 2850 +F 0 "J4" H 4078 2826 50 0000 L CNN +F 1 "Another connector" H 4078 2735 50 0000 L CNN +F 2 "Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Horizontal" H 4050 2850 50 0001 C CNN +F 3 "~" H 4050 2850 50 0001 C CNN +F 4 "1x4" H 4050 2850 50 0001 C CNN "Description" + 1 4050 2850 + 1 0 0 -1 +$EndComp +$Comp +L Connector:Conn_01x04_Female J3 +U 1 1 5F172BD1 +P 2900 2850 +F 0 "J3" H 2928 2826 50 0000 L CNN +F 1 "Bla bla connector" H 2928 2735 50 0000 L CNN +F 2 "Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Horizontal" H 2900 2850 50 0001 C CNN +F 3 "~" H 2900 2850 50 0001 C CNN +F 4 "1x4" H 2900 2850 50 0001 C CNN "Description" + 1 2900 2850 + 1 0 0 -1 +$EndComp +$EndSCHEMATC diff --git a/tests/test_plot/test_int_bom.py b/tests/test_plot/test_int_bom.py index 5302b675..df4c79fd 100644 --- a/tests/test_plot/test_int_bom.py +++ b/tests/test_plot/test_int_bom.py @@ -31,6 +31,7 @@ COMP_COLUMN_NAME_R = 'Renglón' KIBOM_TEST_HEAD = [COMP_COLUMN_NAME , 'Description', 'Part', REF_COLUMN_NAME, 'Value', 'Footprint', QTY_COLUMN_NAME, 'Datasheet', 'Config'] KIBOM_RENAME_HEAD = [COMP_COLUMN_NAME_R, REF_COLUMN_NAME_R, 'Componente', 'Valor', 'Código Digi-Key', 'Cantidad por PCB'] +CONN_HEAD = [COMP_COLUMN_NAME, 'Description', 'Part', REF_COLUMN_NAME, 'Value', 'Footprint', QTY_COLUMN_NAME, 'Datasheet'] 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'] @@ -394,3 +395,30 @@ def test_int_bom_column_rename_xlsx(): check_kibom_test_netlist(rows, ref_column, LINKS_GROUPS, LINKS_EXCLUDE, LINKS_COMPONENTS) ctx.clean_up() + +def test_int_group_connectors(): + """ Default behavior, ignore the 'Value' for connectors """ + prj = 'connectors' + ext = 'csv' + ctx = context.TestContextSCH('test_int_group_connectors', prj, 'int_bom_simple_csv', BOM_DIR) + ctx.run() + out = prj + '-bom.' + ext + rows, header = ctx.load_csv(out) + assert header == CONN_HEAD + ref_column = header.index(REF_COLUMN_NAME) + check_kibom_test_netlist(rows, ref_column, 2, [], ['J4', 'J1', 'J3', 'J2']) + ctx.clean_up() + + +def test_int_no_group_connectors(): + """ group_connectors: false """ + prj = 'connectors' + ext = 'csv' + ctx = context.TestContextSCH('test_int_no_group_connectors', prj, 'int_bom_no_group_connectors', BOM_DIR) + ctx.run() + out = prj + '-bom.' + ext + rows, header = ctx.load_csv(out) + assert header == CONN_HEAD + ref_column = header.index(REF_COLUMN_NAME) + check_kibom_test_netlist(rows, ref_column, 4, [], ['J4', 'J1', 'J3', 'J2']) + ctx.clean_up() diff --git a/tests/yaml_samples/int_bom_no_group_connectors.kiplot.yaml b/tests/yaml_samples/int_bom_no_group_connectors.kiplot.yaml new file mode 100644 index 00000000..36cb6abb --- /dev/null +++ b/tests/yaml_samples/int_bom_no_group_connectors.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: + group_connectors: false + format: CSV +