diff --git a/tests/test_plot/test_int_bom.py b/tests/test_plot/test_int_bom.py index d7af256e..d49a8cbb 100644 --- a/tests/test_plot/test_int_bom.py +++ b/tests/test_plot/test_int_bom.py @@ -544,11 +544,11 @@ def test_int_bom_repeat_csv(): def test_int_bom_collision(): - """ Field collision """ + """ Field collision and exclude_any """ prj = 'kibom-test-3' ext = 'csv' ctx = context.TestContextSCH('test_int_bom_collision', prj, 'int_bom_simple_csv', BOM_DIR) - ctx.run() + ctx.run(extra_debug=True) out = prj + '-bom.' + ext rows, header = ctx.load_csv(out) assert header == KIBOM_TEST_HEAD_TOL @@ -558,3 +558,19 @@ def test_int_bom_collision(): check_dnc(rows, 'R7', ref_column, qty_column) ctx.search_err('Field conflict') ctx.clean_up() + + +def test_int_bom_include_only(): + """ Include only (0805 components) """ + prj = 'kibom-test' + ext = 'csv' + ctx = context.TestContextSCH('test_int_bom_include_only', prj, 'int_bom_include_only', BOM_DIR) + ctx.run(extra_debug=True) + 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, 3, KIBOM_TEST_EXCLUDE, ['R1', 'R2', 'R3', 'R4', 'R5', 'R7', 'R8']) + check_dnc(rows, 'R7', ref_column, qty_column) + ctx.clean_up() diff --git a/tests/utils/context.py b/tests/utils/context.py index bf5f3c57..5a690bba 100644 --- a/tests/utils/context.py +++ b/tests/utils/context.py @@ -154,7 +154,7 @@ class TestContext(object): f.write('Dummy file\n') def run(self, ret_val=None, extra=None, use_a_tty=False, filename=None, no_out_dir=False, no_board_file=False, - no_yaml_file=False, chdir_out=False, no_verbose=False): + no_yaml_file=False, chdir_out=False, no_verbose=False, extra_debug=False): logging.debug('Running '+self.test_name) # Change the command to be local and add the board and output arguments cmd = [COVERAGE_SCRIPT, 'run', '-a'] @@ -165,6 +165,8 @@ class TestContext(object): if not no_verbose: # One is enough, 2 can generate tons of data when loading libs cmd.append('-v') + if extra_debug: + cmd.append('-v') if not no_board_file: if self.mode == MODE_PCB: cmd = cmd+['-b', filename if filename else self.board_file] diff --git a/tests/yaml_samples/int_bom_include_only.kiplot.yaml b/tests/yaml_samples/int_bom_include_only.kiplot.yaml new file mode 100644 index 00000000..888416fc --- /dev/null +++ b/tests/yaml_samples/int_bom_include_only.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: + include_only: + - column: 'Footprint' + regex: '0805'