Added tests for missing out_bom cases.
- No file in aggregate - Missing file in aggregate - Sch not loaded
This commit is contained in:
parent
602f0dd261
commit
d12837d5ba
|
|
@ -19,6 +19,7 @@ from kibot.gs import GS
|
|||
from kibot.kiplot import load_actions, _import
|
||||
from kibot.registrable import RegOutput, RegFilter
|
||||
from kibot.misc import (MISSING_TOOL, WRONG_INSTALL, BOM_ERROR)
|
||||
from kibot.bom.columnlist import ColumnList
|
||||
|
||||
|
||||
cov = coverage.Coverage()
|
||||
|
|
@ -187,3 +188,19 @@ def test_var_rename_no_variant():
|
|||
# Stop coverage
|
||||
cov.stop()
|
||||
cov.save()
|
||||
|
||||
|
||||
def test_bom_no_sch():
|
||||
# Start coverage
|
||||
cov.load()
|
||||
cov.start()
|
||||
# Load the plug-ins
|
||||
load_actions()
|
||||
# Create an ibom object
|
||||
out = RegOutput.get_class_for('bom')()
|
||||
GS.sch = None
|
||||
columns = out.options._get_columns()
|
||||
assert columns == ColumnList.COLUMNS_DEFAULT
|
||||
# Stop coverage
|
||||
cov.stop()
|
||||
cov.save()
|
||||
|
|
|
|||
|
|
@ -640,3 +640,17 @@ def test_error_no_column_id(test_dir):
|
|||
ctx.run(EXIT_BAD_CONFIG)
|
||||
assert ctx.search_err("Missing or empty `id` in columns list")
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_error_aggregate_no_file(test_dir):
|
||||
ctx = context.TestContext(test_dir, 'test_error_aggregate_no_file', 'bom', 'error_aggregate_no_file', '')
|
||||
ctx.run(EXIT_BAD_CONFIG)
|
||||
assert ctx.search_err("Missing or empty `file` in aggregate list")
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_error_aggregate_miss_file(test_dir):
|
||||
ctx = context.TestContext(test_dir, 'test_error_aggregate_miss_file', 'bom', 'error_aggregate_miss_file', '')
|
||||
ctx.run(EXIT_BAD_CONFIG)
|
||||
assert ctx.search_err("Missing `dummy`")
|
||||
ctx.clean_up()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
# Example KiBot config file
|
||||
kibot:
|
||||
version: 1
|
||||
|
||||
outputs:
|
||||
- name: 'bom_csv'
|
||||
comment: "Bill of Materials in CSV format"
|
||||
type: bom
|
||||
dir: BoM
|
||||
options:
|
||||
format: CSV
|
||||
ref_id: 'A:'
|
||||
source_by_id: true
|
||||
use_alt: true
|
||||
aggregate:
|
||||
- file: dummy
|
||||
name: 2nd project
|
||||
ref_id: 'B:'
|
||||
number: 2
|
||||
- file: tests/board_samples/kicad_5/merge_3.sch
|
||||
ref_id: 'C:'
|
||||
number: 4
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
# Example KiBot config file
|
||||
kibot:
|
||||
version: 1
|
||||
|
||||
outputs:
|
||||
- name: 'bom_csv'
|
||||
comment: "Bill of Materials in CSV format"
|
||||
type: bom
|
||||
dir: BoM
|
||||
options:
|
||||
format: CSV
|
||||
ref_id: 'A:'
|
||||
source_by_id: true
|
||||
use_alt: true
|
||||
aggregate:
|
||||
- name: 2nd project
|
||||
ref_id: 'B:'
|
||||
number: 2
|
||||
- file: tests/board_samples/kicad_5/merge_3.sch
|
||||
ref_id: 'C:'
|
||||
number: 4
|
||||
|
||||
Loading…
Reference in New Issue