Added test for the `html_generate_dnf` internal BoM.
This commit is contained in:
parent
1455ccdc2a
commit
6c26bd4ec6
|
|
@ -258,6 +258,7 @@ def test_int_bom_join_1():
|
|||
|
||||
|
||||
def test_int_include_dnf():
|
||||
""" ignore_dnf: false """
|
||||
prj = 'kibom-test'
|
||||
ext = 'csv'
|
||||
ctx = context.TestContextSCH('test_int_include_dnf', prj, 'int_bom_include_dnf', BOM_DIR)
|
||||
|
|
@ -270,3 +271,28 @@ def test_int_include_dnf():
|
|||
check_kibom_test_netlist(rows, ref_column, KIBOM_TEST_GROUPS+1, [], KIBOM_TEST_COMPONENTS+KIBOM_TEST_EXCLUDE)
|
||||
check_dnc(rows, 'R7', ref_column, qty_column)
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_int_bom_html_generate_dnf():
|
||||
""" html_generate_dnf: false """
|
||||
prj = 'kibom-test'
|
||||
ext = 'html'
|
||||
ctx = context.TestContextSCH('test_int_bom_html_generate_dnf', prj, 'int_bom_html_generate_dnf', BOM_DIR)
|
||||
ctx.run()
|
||||
out = prj + '-bom.' + ext
|
||||
rows, headers = ctx.load_html(out)
|
||||
logging.debug(rows)
|
||||
# Test we got the normal and DNF tables
|
||||
assert len(rows) == 1
|
||||
assert len(headers) == 1
|
||||
# Test both tables has the same headings and they are the expected
|
||||
head_no_comp = deepcopy(KIBOM_TEST_HEAD)
|
||||
head_no_comp[0] = '' # HTML numbered column doesn't have a name
|
||||
assert headers[0] == head_no_comp
|
||||
# Look for reference and quantity columns
|
||||
ref_column = headers[0].index(REF_COLUMN_NAME)
|
||||
qty_column = headers[0].index(QTY_COLUMN_NAME)
|
||||
check_kibom_test_netlist(rows[0], ref_column, KIBOM_TEST_GROUPS, KIBOM_TEST_EXCLUDE, KIBOM_TEST_COMPONENTS)
|
||||
check_dnc(rows[0], 'R7', ref_column, qty_column)
|
||||
ctx.clean_up()
|
||||
|
||||
|
|
|
|||
|
|
@ -363,11 +363,13 @@ class TestContext(object):
|
|||
file = self.expect_out_file(os.path.join(self.sub_dir, filename))
|
||||
with open(file) as f:
|
||||
html = f.read()
|
||||
rows = [[], []]
|
||||
headers = [[], []]
|
||||
rows = []
|
||||
headers = []
|
||||
c = 0
|
||||
for body in re.findall(r'<table.*?>((?:\s+.*?)+)</table>', html, re.MULTILINE):
|
||||
if c:
|
||||
rows.append([])
|
||||
headers.append([])
|
||||
# Header
|
||||
m = re.search(r'<tr>\s+((?:<th.*?>(?:.*)</th>\s+)+)</tr>', body, re.MULTILINE)
|
||||
assert m, 'Failed to get table header'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
# Example KiPlot config file
|
||||
kiplot:
|
||||
version: 1
|
||||
|
||||
outputs:
|
||||
- name: 'bom_internal'
|
||||
comment: "Bill of Materials in HTML format"
|
||||
type: bom
|
||||
dir: BoM
|
||||
options:
|
||||
format: HTML
|
||||
html_generate_dnf: false
|
||||
|
||||
Loading…
Reference in New Issue