Added more tests for the filters and variants.

This commit is contained in:
Salvador E. Tropea 2020-09-01 18:49:38 -03:00
parent 9ebf18ba11
commit e0de652105
5 changed files with 93 additions and 0 deletions

View File

@ -1283,3 +1283,22 @@ def test_int_bom_fil_1():
rows, header, info = ctx.load_csv('multi.csv')
check_kibom_test_netlist(rows, ref_column, 1, None, ['C1-C2'])
ctx.clean_up()
def test_int_bom_variant_t3():
""" Test if we can move the filters to the variant.
Also test the '!' filter (always false) """
prj = 'kibom-variante'
ctx = context.TestContextSCH('test_int_bom_variant_t3', prj, 'int_bom_var_t3_csv', BOM_DIR)
ctx.run()
rows, header, info = ctx.load_csv(prj+'-bom_(V1).csv')
ref_column = header.index(REF_COLUMN_NAME)
check_kibom_test_netlist(rows, ref_column, 2, ['R3', 'R4'], ['R1', 'R2'])
VARIANTE_PRJ_INFO[1] = 't1_v1'
check_csv_info(info, VARIANTE_PRJ_INFO, [4, 20, 2, 1, 2])
ctx.search_err(r"Creating internal filter(.*)_mechanical")
ctx.search_err(r"Creating internal filter(.*)_kibom_dnf_Config")
ctx.search_err(r"Creating internal filter(.*)_kibom_dnc")
rows, header, info = ctx.load_csv(prj+'-bom_(V1b).csv')
# Here we remove the DNC, so R1 and R2 becomes identical
check_kibom_test_netlist(rows, ref_column, 1, ['R3', 'R4'], ['R1', 'R2'])

View File

@ -578,3 +578,17 @@ def test_error_fil_unknown():
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown filter (.*) used for ")
ctx.clean_up()
def test_error_var_unknown():
ctx = context.TestContextSCH('test_error_var_unknown', 'links', 'error_unk_variant', '')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown variant name")
ctx.clean_up()
def test_error_wrong_fil_name():
ctx = context.TestContextSCH('test_error_wrong_fil_name', 'links', 'error_wrong_fil_name', '')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Filter names starting with (.*) are reserved")
ctx.clean_up()

View File

@ -0,0 +1,11 @@
# Example KiBot config file
kibot:
version: 1
outputs:
- name: 'no_inductor'
comment: "Inductors removed"
type: sch_variant
dir: no_inductor
options:
variant: 'no_inductor'

View File

@ -0,0 +1,10 @@
# Example KiBot config file
kibot:
version: 1
filters:
- name: '_no_inductor'
comment: 'Inductors removed'
type: generic
exclude_refs:
- L*

View File

@ -0,0 +1,39 @@
# Example KiBot config file
kibot:
version: 1
variants:
- name: 't1_v1'
comment: 'Test 1 Variant V1'
type: kibom
file_id: '_(V1)'
variant: V1
dnc_filter: '_kibom_dnc'
dnf_filter: '_kibom_dnf_Config'
exclude_filter: '_mechanical'
- name: 't1_v1b'
comment: 'Test 1 Variant V1'
type: kibom
file_id: '_(V1b)'
variant: V1
outputs:
- name: 'bom_internal_v1'
comment: "Bill of Materials in CSV format for variant t1_v1"
type: bom
dir: BoM
options:
variant: t1_v1
dnc_filter: '_none'
dnf_filter: '_none'
exclude_filter: '_none'
- name: 'bom_internal_v1b'
comment: "Bill of Materials in CSV format for variant t1_v1"
type: bom
dir: BoM
options:
variant: t1_v1b
dnc_filter: '!'