Added "include_only" test.

This commit is contained in:
SET 2020-08-11 18:51:35 -03:00
parent c4833e198a
commit 0f4fa12f1f
3 changed files with 34 additions and 3 deletions

View File

@ -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()

View File

@ -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]

View File

@ -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'