More test simplifications

This commit is contained in:
Salvador E. Tropea 2022-06-10 21:09:34 -03:00
parent 78b55b916a
commit e6b98bd5aa
9 changed files with 139 additions and 174 deletions

View File

@ -4,8 +4,6 @@ Tests for PcbDraw.
For debug information use:
pytest-3 --log-cli-level debug
"""
import os
import coverage
from shutil import which
from . import context
@ -20,8 +18,8 @@ def test_pcbdraw_3Rs(test_dir):
prj = '3Rs'
ctx = context.TestContext(test_dir, prj, 'pcbdraw', OUT_DIR)
ctx.run()
ctx.expect_out_file(os.path.join(OUT_DIR, prj+'-top.svg'))
ctx.expect_out_file(os.path.join(OUT_DIR, prj+'-bottom.svg'))
ctx.expect_out_file_d(prj+'-top.svg')
ctx.expect_out_file_d(prj+'-bottom.svg')
ctx.clean_up()
@ -29,8 +27,8 @@ def test_pcbdraw_simple(test_dir):
prj = 'bom'
ctx = context.TestContext(test_dir, prj, 'pcbdraw_simple', OUT_DIR)
ctx.run()
ctx.expect_out_file(os.path.join(OUT_DIR, prj+'-top.png'))
ctx.expect_out_file(os.path.join(OUT_DIR, prj+'-bottom.jpg'))
ctx.expect_out_file_d(prj+'-top.png')
ctx.expect_out_file_d(prj+'-bottom.jpg')
ctx.clean_up()

View File

@ -13,17 +13,15 @@ def test_pdf(test_dir):
prj = 'simple_2layer'
ctx = context.TestContext(test_dir, prj, 'pdf', PS_DIR)
ctx.run()
f_cu = ctx.get_gerber_filename('F_Cu', '.pdf')
f_silk = ctx.get_gerber_filename('B_Silks', '.pdf')
ctx.expect_out_file(f_cu)
ctx.expect_out_file(f_silk)
ctx.expect_out_file(ctx.get_gerber_filename('F_Cu', '.pdf'))
ctx.expect_out_file(ctx.get_gerber_filename('B_Silks', '.pdf'))
ctx.dont_expect_out_file(ctx.get_gerber_job_filename())
ctx.clean_up()
def test_pdf_refill_1(test_dir):
prj = 'zone-refill'
ctx = context.TestContext(test_dir, prj, 'pdf_zone-refill', '')
ctx = context.TestContext(test_dir, prj, 'pdf_zone-refill')
ctx.run()
b_cu = ctx.get_gerber_filename('B_Cu', '.pdf')
ctx.expect_out_file(b_cu)
@ -33,7 +31,7 @@ def test_pdf_refill_1(test_dir):
def test_pdf_refill_2(test_dir):
prj = 'zone-refill'
ctx = context.TestContext(test_dir, prj, 'pdf_zone-refill_2', '')
ctx = context.TestContext(test_dir, prj, 'pdf_zone-refill_2')
ori = ctx.board_file
bkp = ori+'-bak'
try:
@ -50,7 +48,7 @@ def test_pdf_refill_2(test_dir):
def test_pdf_variant_1(test_dir):
prj = 'kibom-variant_4'
ctx = context.TestContext(test_dir, prj, 'pdf_variant_1', '')
ctx = context.TestContext(test_dir, prj, 'pdf_variant_1')
ctx.run()
fname = prj+'-F_Fab.pdf'
ctx.expect_out_file(fname)

View File

@ -8,10 +8,7 @@ For debug information use:
pytest-3 --log-cli-level debug
"""
import os
from . import context
PDF_DIR = 'Layers'
PDF_FILE = 'bom-F_Cu+F_SilkS.pdf'
PDF_FILE_B = 'PCB_Bot.pdf'
@ -23,13 +20,13 @@ def test_print_pcb_simple(test_dir):
ctx = context.TestContext(test_dir, prj, 'print_pcb', PDF_DIR)
ctx.run()
# Check all outputs are there
ctx.expect_out_file(os.path.join(PDF_DIR, PDF_FILE))
ctx.expect_out_file_d(PDF_FILE)
ctx.clean_up()
def test_print_pcb_svg_simple(test_dir):
prj = 'bom'
ctx = context.TestContext(test_dir, prj, 'print_pcb_svg', '')
ctx = context.TestContext(test_dir, prj, 'print_pcb_svg')
ctx.run()
# Check all outputs are there
file = PDF_FILE.replace('.pdf', '.svg')
@ -40,7 +37,7 @@ def test_print_pcb_svg_simple(test_dir):
def test_print_pcb_refill_1(test_dir):
prj = 'zone-refill'
ctx = context.TestContext(test_dir, prj, 'print_pcb_zone-refill', '')
ctx = context.TestContext(test_dir, prj, 'print_pcb_zone-refill')
ctx.run()
ctx.expect_out_file(PDF_FILE_B)
ctx.compare_image(PDF_FILE_B)
@ -52,7 +49,7 @@ def test_print_pcb_refill_2(test_dir):
if context.ki5():
return
prj = 'zone-refill'
ctx = context.TestContext(test_dir, prj, 'print_pcb_zone-refill_def', '')
ctx = context.TestContext(test_dir, prj, 'print_pcb_zone-refill_def')
ctx.run()
ctx.expect_out_file(PDF_FILE_B)
ctx.compare_image(PDF_FILE_B, PDF_FILE_C)
@ -61,7 +58,7 @@ def test_print_pcb_refill_2(test_dir):
def test_print_variant_1(test_dir):
prj = 'kibom-variant_3_txt'
ctx = context.TestContext(test_dir, prj, 'print_pcb_variant_1', '')
ctx = context.TestContext(test_dir, prj, 'print_pcb_variant_1')
ctx.run()
# Check all outputs are there
fname = prj+'-F_Fab.pdf'
@ -86,33 +83,31 @@ def test_print_wrong_paste(test_dir):
ctx = context.TestContext(test_dir, prj, 'wrong_paste', PDF_DIR)
ctx.run()
# Check all outputs are there
fname = prj+'-F_Fab.pdf'
ctx.expect_out_file(fname)
ctx.expect_out_file(prj+'-F_Fab.pdf')
ctx.search_err(r'Pad with solder paste, but no copper')
ctx.clean_up()
def test_pcb_print_simple_1(test_dir):
prj = 'light_control'
ctx = context.TestContext(test_dir, prj, 'pcb_print_2', '')
ctx = context.TestContext(test_dir, prj, 'pcb_print_2')
ctx.run()
ctx.expect_out_file(prj+'-assembly_page_01.png')
ctx.expect_out_file(prj+'-assembly_page_02.png')
ctx.expect_out_file(prj+'-assembly_page_01.eps')
ctx.expect_out_file(prj+'-assembly_page_01.svg')
ctx.expect_out_file(prj+'-assembly.ps')
ctx.clean_up(keep_project=True)
def test_pcb_print_simple_2(test_dir):
if context.ki6():
prj = 'pcb_print_rare'
ctx = context.TestContext(test_dir, prj, 'pcb_print_3', '')
ctx.run()
ctx.expect_out_file(prj+'-assembly.pdf')
ctx.clean_up()
yaml = 'pcb_print_3'
else:
prj = 'bom'
ctx = context.TestContext(test_dir, prj, 'pcb_print_4', '')
ctx.run()
ctx.expect_out_file(prj+'-assembly.pdf')
ctx.clean_up()
yaml = 'pcb_print_4'
ctx = context.TestContext(test_dir, prj, yaml)
ctx.run()
ctx.expect_out_file(prj+'-assembly.pdf')
ctx.clean_up()

View File

@ -27,7 +27,7 @@ cov = coverage.Coverage()
def test_print_sch_ok(test_dir):
prj = 'bom_no_xml' # bom has meta data, here we test no meta-data
ctx = context.TestContext(test_dir, prj, 'print_sch', PDF_DIR)
ctx = context.TestContext(test_dir, prj, 'print_sch')
ctx.run()
# Check all outputs are there
ctx.expect_out_file(PDF_FILE)
@ -36,7 +36,7 @@ def test_print_sch_ok(test_dir):
def test_print_sch_fail(test_dir):
prj = 'print_err'
ctx = context.TestContextSCH(test_dir, prj, 'print_sch', PDF_DIR)
ctx = context.TestContextSCH(test_dir, prj, 'print_sch')
ctx.run(PDF_SCH_PRINT, no_board_file=True, extra=['-e', os.path.join(ctx.get_board_dir(),
'print_err'+context.KICAD_SCH_EXT)])
ctx.clean_up()
@ -44,7 +44,7 @@ def test_print_sch_fail(test_dir):
def test_print_sch_svg_ok(test_dir):
prj = 'bom_no_xml' # bom has meta data, here we test no meta-data
ctx = context.TestContext(test_dir, prj, 'print_sch_svg', PDF_DIR)
ctx = context.TestContext(test_dir, prj, 'print_sch_svg')
ctx.run()
# Check all outputs are there
ctx.expect_out_file(SVG_FILE)
@ -53,7 +53,7 @@ def test_print_sch_svg_ok(test_dir):
def test_print_sch_svg_fail(test_dir):
prj = 'print_err'
ctx = context.TestContext(test_dir, prj, 'print_sch_svg', PDF_DIR)
ctx = context.TestContext(test_dir, prj, 'print_sch_svg')
ctx.run(SVG_SCH_PRINT, no_board_file=True, extra=['-e', os.path.join(ctx.get_board_dir(),
'print_err'+context.KICAD_SCH_EXT)])
ctx.clean_up()
@ -86,21 +86,21 @@ def check_l1(ctx):
def test_sch_variant_ni_1(test_dir):
""" Using a variant """
prj = 'test_v5' # Is the most complete, contains every KiCad object I know
ctx = context.TestContextSCH(test_dir, prj, 'sch_no_inductors_1', PDF_DIR)
ctx = context.TestContextSCH(test_dir, prj, 'sch_no_inductors_1')
check_l1(ctx)
def test_sch_variant_ni_2(test_dir):
""" Using a filter """
prj = 'test_v5' # Is the most complete, contains every KiCad object I know
ctx = context.TestContextSCH(test_dir, prj, 'sch_no_inductors_2', PDF_DIR)
ctx = context.TestContextSCH(test_dir, prj, 'sch_no_inductors_2')
check_l1(ctx)
def test_print_sch_variant_ni_1(test_dir):
""" Using a variant """
prj = 'test_v5_wks' # Is the most complete, contains every KiCad object I know
ctx = context.TestContextSCH(test_dir, prj, 'print_pdf_no_inductors_1', PDF_DIR)
ctx = context.TestContextSCH(test_dir, prj, 'print_pdf_no_inductors_1')
ctx.run()
r_name = 'test_v5_wks-schematic_(no_L).pdf'
o_name = os.path.join(NI_DIR, r_name)
@ -112,7 +112,7 @@ def test_print_sch_variant_ni_1(test_dir):
def test_print_sch_svg_variant_ni_1(test_dir):
""" SVG using a variant """
prj = 'test_v5' # Is the most complete, contains every KiCad object I know
ctx = context.TestContextSCH(test_dir, prj, 'print_svg_no_inductors_1', PDF_DIR)
ctx = context.TestContextSCH(test_dir, prj, 'print_svg_no_inductors_1')
ctx.run()
r_name = 'test_v5-schematic_(no_L).svg'
o_name = os.path.join(NI_DIR, r_name)
@ -124,7 +124,7 @@ def test_print_sch_svg_variant_ni_1(test_dir):
def test_print_sch_variant_ni_2(test_dir):
""" Using a filter """
prj = 'test_v5' # Is the most complete, contains every KiCad object I know
ctx = context.TestContextSCH(test_dir, prj, 'print_pdf_no_inductors_2', PDF_DIR)
ctx = context.TestContextSCH(test_dir, prj, 'print_pdf_no_inductors_2')
ctx.run()
r_name = 'test_v5-schematic_(no_L).pdf'
o_name = os.path.join(NI_DIR, 'test_v5-schematic.pdf')
@ -137,7 +137,7 @@ def test_sch_missing_1(test_dir):
""" R1 exists in l1.lib, but the lib isn't specified.
R2 is bogus, completely missing """
prj = 'missing'
ctx = context.TestContextSCH(test_dir, prj, 'sch_no_inductors_1', PDF_DIR)
ctx = context.TestContextSCH(test_dir, prj, 'sch_no_inductors_1')
ctx.run()
o_name = os.path.join(NI_DIR, prj+context.KICAD_SCH_EXT)
ctx.expect_out_file(o_name)
@ -156,7 +156,7 @@ def test_sch_missing_filtered(test_dir):
""" R1 exists in l1.lib, but the lib isn't specified.
R2 is bogus, completely missing """
prj = 'missing'
ctx = context.TestContextSCH(test_dir, prj, 'sch_no_inductors_1_filtered', PDF_DIR)
ctx = context.TestContextSCH(test_dir, prj, 'sch_no_inductors_1_filtered')
ctx.run()
o_name = os.path.join(NI_DIR, prj+context.KICAD_SCH_EXT)
ctx.expect_out_file(o_name)

View File

@ -12,13 +12,9 @@ def test_ps(test_dir):
prj = 'simple_2layer'
ctx = context.TestContext(test_dir, prj, 'ps', PS_DIR)
ctx.run()
f_cu = ctx.get_gerber_filename('F_Cu', '.ps')
f_fab = ctx.get_gerber_filename('F_Fab', '.ps')
ctx.expect_out_file(f_cu)
ctx.expect_out_file(f_fab)
ctx.expect_out_file(ctx.get_gerber_filename('F_Cu', '.ps'))
ctx.expect_out_file(ctx.get_gerber_filename('F_Fab', '.ps'))
ctx.dont_expect_out_file(ctx.get_gerber_job_filename())
ctx.clean_up()
@ -26,11 +22,7 @@ def test_ps_auto(test_dir):
prj = 'simple_2layer'
ctx = context.TestContext(test_dir, prj, 'ps_auto', PS_DIR)
ctx.run()
f_cu = ctx.get_gerber_filename('F_Cu', '.ps')
f_fab = ctx.get_gerber_filename('F_Fab', '.ps')
ctx.expect_out_file(f_cu)
ctx.expect_out_file(f_fab)
ctx.expect_out_file(ctx.get_gerber_filename('F_Cu', '.ps'))
ctx.expect_out_file(ctx.get_gerber_filename('F_Fab', '.ps'))
ctx.dont_expect_out_file(ctx.get_gerber_job_filename())
ctx.clean_up()

View File

@ -12,7 +12,7 @@ from kibot.misc import CORRUPTED_SCH
def setup_ctx(test_dir, test, error):
sch = ('v5' if context.ki5() else 'v6')+'_errors/error_'+test
test = 'test_sch_errors_'+test
ctx = context.TestContextSCH(test_dir, sch, 'int_bom_simple_csv', None, test_name='sch_'+test)
ctx = context.TestContextSCH(test_dir, sch, 'int_bom_simple_csv', test_name='sch_'+test)
ctx.run(CORRUPTED_SCH)
ctx.search_err(error)
ctx.clean_up()
@ -309,5 +309,5 @@ def test_imported_k6(test_dir):
""" Test we can load an schematic with an imported sub-sheet (#178) """
if context.ki6():
prj = 'imported_top'
ctx = context.TestContextSCH(test_dir, prj, 'int_bom_simple_csv', None)
ctx = context.TestContextSCH(test_dir, prj, 'int_bom_simple_csv')
ctx.run()

View File

@ -22,10 +22,10 @@ def test_step_1(test_dir):
ctx = context.TestContext(test_dir, prj, 'step_simple', STEP_DIR)
ctx.run()
# Check all outputs are there
name = os.path.join(STEP_DIR, prj+'-3D.step')
ctx.expect_out_file(name)
name = prj+'-3D.step'
ctx.expect_out_file_d(name)
# Check the R and C 3D models are there
ctx.search_in_file(name, ['R_0805_2012Metric', 'C_0805_2012Metric'])
ctx.search_in_file_d(name, ['R_0805_2012Metric', 'C_0805_2012Metric'])
ctx.search_err(['Missing 3D model for R1: `(.*)R_0805_2012Metrico',
'Failed to download `(.*)R_0805_2012Metrico'])
ctx.clean_up()
@ -39,7 +39,7 @@ def test_step_2(test_dir):
ctx = context.TestContext(test_dir, prj, 'step_simple_2', STEP_DIR)
ctx.run()
# Check all outputs are there
ctx.expect_out_file(os.path.join(STEP_DIR, prj+'-3D.step'))
ctx.expect_out_file_d(prj+'-3D.step')
ctx.search_err(['Missing 3D model for C1', 'Could not add 3D model to C1'], invert=True)
ctx.clean_up(keep_project=True)
@ -49,13 +49,13 @@ def test_step_3(test_dir):
ctx = context.TestContext(test_dir, prj, 'step_simple_3', STEP_DIR)
ctx.run()
# Check all outputs are there
ctx.expect_out_file(os.path.join(STEP_DIR, prj+'.step'))
ctx.expect_out_file_d(prj+'.step')
ctx.clean_up()
def test_step_variant_1(test_dir):
prj = 'kibom-variant_3'
ctx = context.TestContext(test_dir, prj, 'step_variant_1', '')
ctx = context.TestContext(test_dir, prj, 'step_variant_1')
ctx.run(extra_debug=True)
# Check all outputs are there
ctx.expect_out_file(prj+'-3D.step')
@ -71,7 +71,7 @@ def test_render_3d_variant_1(test_dir):
yaml = 'render_3d_variant_1'
if context.ki5():
yaml += '_k5'
ctx = context.TestContext(test_dir, prj, yaml, '')
ctx = context.TestContext(test_dir, prj, yaml)
ctx.run()
# Check all outputs are there
name = prj+'-3D_top.png'

View File

@ -12,13 +12,9 @@ def test_svg(test_dir):
prj = 'simple_2layer'
ctx = context.TestContext(test_dir, prj, 'svg', PS_DIR)
ctx.run()
f_cu = ctx.get_gerber_filename('F_Cu', '.svg')
f_fab = ctx.get_gerber_filename('F_Fab', '.svg')
ctx.expect_out_file(f_cu)
ctx.expect_out_file(f_fab)
ctx.expect_out_file(ctx.get_gerber_filename('F_Cu', '.svg'))
ctx.expect_out_file(ctx.get_gerber_filename('F_Fab', '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_job_filename())
ctx.clean_up()
@ -26,7 +22,6 @@ def test_svg_all(test_dir):
prj = 'simple_2layer'
ctx = context.TestContext(test_dir, prj, 'svg_all', PS_DIR)
ctx.run()
ctx.expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_ADHES, '.svg'))
ctx.expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_CRTYD, '.svg'))
ctx.expect_out_file(ctx.get_gerber_filename('B_Cu', '.svg'))
@ -48,7 +43,6 @@ def test_svg_all(test_dir):
ctx.expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_SILKS, '.svg'))
ctx.expect_out_file(ctx.get_gerber_filename('Margin', '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_job_filename())
ctx.clean_up()
@ -56,7 +50,6 @@ def test_svg_selected(test_dir):
prj = 'simple_2layer'
ctx = context.TestContext(test_dir, prj, 'svg_selected', PS_DIR)
ctx.run()
ctx.dont_expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_ADHES, '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_filename('B_'+context.DEF_CRTYD, '.svg'))
ctx.expect_out_file(ctx.get_gerber_filename('B_Cu', '.svg'))
@ -78,7 +71,6 @@ def test_svg_selected(test_dir):
ctx.expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_SILKS, '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_filename('Margin', '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_job_filename())
ctx.clean_up()
@ -86,7 +78,6 @@ def test_svg_copper_and_user(test_dir):
prj = 'good-project'
ctx = context.TestContext(test_dir, prj, 'svg_copper_and_user', PS_DIR)
ctx.run()
ctx.expect_out_file(ctx.get_gerber_filename('B_Cu', '.svg'))
ctx.expect_out_file(ctx.get_gerber_filename(context.DEF_CMTSU, '.svg'))
ctx.expect_out_file(ctx.get_gerber_filename(context.DEF_DWGSU, '.svg'))
@ -112,7 +103,6 @@ def test_svg_copper_and_user(test_dir):
ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Paste', '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_SILKS, '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_job_filename())
ctx.clean_up()
@ -120,7 +110,6 @@ def test_svg_copper_and_draw(test_dir):
prj = 'good-project'
ctx = context.TestContext(test_dir, prj, 'svg_copper_and_draw', PS_DIR)
ctx.run()
ctx.expect_out_file(ctx.get_gerber_filename('B_Cu', '.svg'))
# This name is selected manually:
ctx.expect_out_file(ctx.get_gerber_filename('Dwgs_User', '.svg'))
@ -147,7 +136,6 @@ def test_svg_copper_and_draw(test_dir):
ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Paste', '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_SILKS, '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_job_filename())
ctx.clean_up()
@ -155,7 +143,6 @@ def test_svg_copper_and_cmt(test_dir):
prj = 'good-project'
ctx = context.TestContext(test_dir, prj, 'svg_copper_and_cmt', PS_DIR)
ctx.run()
ctx.expect_out_file(ctx.get_gerber_filename('B_Cu', '.svg'))
ctx.expect_out_file(ctx.get_gerber_filename('F_Cu', '.svg'))
ctx.expect_out_file(ctx.get_gerber_filename('GND_Cu', '.svg'))
@ -181,7 +168,6 @@ def test_svg_copper_and_cmt(test_dir):
ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Paste', '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_SILKS, '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_job_filename())
ctx.clean_up()
@ -189,7 +175,6 @@ def test_svg_anchor(test_dir):
prj = 'good-project'
ctx = context.TestContext(test_dir, prj, 'svg_anchor', PS_DIR)
ctx.run(extra=['SVG'])
assert ctx.search_out(r"- 'SVG files' \(SVG\) \[svg\]")
ctx.expect_out_file(ctx.get_gerber_filename('B_Cu', '.svg'))
ctx.expect_out_file(ctx.get_gerber_filename('F_Cu', '.svg'))
@ -216,7 +201,6 @@ def test_svg_anchor(test_dir):
ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Paste', '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_SILKS, '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_job_filename())
ctx.clean_up()
@ -224,7 +208,6 @@ def test_svg_technical(test_dir):
prj = 'good-project'
ctx = context.TestContext(test_dir, prj, 'svg_technical', PS_DIR)
ctx.run()
ctx.dont_expect_out_file(ctx.get_gerber_filename('B_Cu', '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_filename('F_Cu', '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_filename('GND_Cu', '.svg'))
@ -250,5 +233,4 @@ def test_svg_technical(test_dir):
ctx.expect_out_file(ctx.get_gerber_filename('F_Paste', '.svg'))
ctx.expect_out_file(ctx.get_gerber_filename('F_'+context.DEF_SILKS, '.svg'))
ctx.dont_expect_out_file(ctx.get_gerber_job_filename())
ctx.clean_up()

View File

@ -55,133 +55,133 @@ PRJ = 'fail-project'
def test_no_version(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_no_version', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_no_version')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err('YAML config needs `kibot.version`.')
ctx.clean_up()
def test_wrong_version(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_version', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_version')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err('Unknown KiBot config version: 20')
ctx.clean_up()
def test_wrong_version_2(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_version_2', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_version_2')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err('Incorrect .?kibot.? section')
ctx.clean_up()
def test_wrong_version_3(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_version_3', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_version_3')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err('YAML config needs .?kibot.version.?')
ctx.clean_up()
def test_drill_map_no_type_1(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_map_no_type', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_map_no_type')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Empty option .?map.?")
ctx.clean_up()
def test_drill_map_no_type_2(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_map_no_type_2', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_map_no_type_2')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown option .?types.?")
ctx.clean_up()
def test_drill_map_wrong_type_1(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_map_wrong_type', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_map_wrong_type')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Option .?type.? must be any of")
ctx.clean_up()
def test_drill_map_wrong_type_2(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_map_wrong_type_2', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_map_wrong_type_2')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Option .?type.? must be a string")
ctx.clean_up()
def test_drill_map_wrong_type_3(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_map_wrong_type_3', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_map_wrong_type_3')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Option .?map.? must be any of")
ctx.clean_up()
def test_drill_report_no_type_1(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_report_no_type', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_report_no_type')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Empty option .?report.?")
ctx.clean_up()
def test_drill_report_no_type_2(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_report_no_type_2', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_report_no_type_2')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown option .?filenames.?")
ctx.clean_up()
def test_drill_report_wrong_type_2(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_report_wrong_type_2', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_report_wrong_type_2')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Option .?filename.? must be a string")
ctx.clean_up()
def test_drill_report_wrong_type_3(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_report_wrong_type_3', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_drill_report_wrong_type_3')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Option .?report.? must be any of")
ctx.clean_up()
def test_wrong_layer_1(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_1', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_1')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown layer name: .?F.Bogus.?")
ctx.clean_up()
def test_wrong_layer_2(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_2', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_2')
ctx.run(PLOT_ERROR)
assert ctx.search_err("Inner layer (.*) is not valid for this board")
ctx.clean_up()
def test_wrong_layer_3(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_3', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_3')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Malformed inner layer name: .?Inner_1.?,")
ctx.clean_up()
def test_wrong_layer_4(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_4', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_4')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(".?layers.? must be any of")
ctx.clean_up()
def test_wrong_layer_5(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_5', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_5')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown option .?bogus.?")
ctx.clean_up()
def test_wrong_layer_6(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_6', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_6')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Missing or empty .?layer.? attribute")
ctx.clean_up()
@ -189,7 +189,7 @@ def test_wrong_layer_6(test_dir):
def test_wrong_layer_7(test_dir):
""" List of numbers """
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_7', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_7')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(".?layers.? must be any of")
ctx.clean_up()
@ -197,7 +197,7 @@ def test_wrong_layer_7(test_dir):
def test_wrong_layer_9(test_dir):
""" A bogus string """
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_9', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_9')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown layer spec: .?nada.?")
ctx.clean_up()
@ -205,42 +205,42 @@ def test_wrong_layer_9(test_dir):
def test_wrong_layer_8(test_dir):
""" List of strings, but number in middle """
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_8', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_wrong_layer_8')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(".?4.? must be any of")
ctx.clean_up()
def test_no_name(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_no_name', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_no_name')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Output needs a name")
ctx.clean_up()
def test_empty_name(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_empty_name', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_empty_name')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Output needs a name")
ctx.clean_up()
def test_no_type(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_no_type', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_no_type')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Output .PDF. needs a type")
ctx.clean_up()
def test_out_unknown_attr(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_unk_attr', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_unk_attr')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown option .?directory.?")
ctx.clean_up()
def test_out_needs_type(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_needs_type', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_needs_type')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("needs a type")
ctx.clean_up()
@ -248,77 +248,77 @@ def test_out_needs_type(test_dir):
# Now is valid
# def test_no_options(test_dir):
# ctx = context.TestContext(test_dir, '3Rs', 'error_no_options', None)
# ctx = context.TestContext(test_dir, '3Rs', 'error_no_options')
# ctx.run(EXIT_BAD_CONFIG)
# assert ctx.search_err("Output .PDF. needs options")
# ctx.clean_up()
def test_no_layers(test_dir):
ctx = context.TestContext(test_dir, '3Rs', 'error_no_layers', None)
ctx = context.TestContext(test_dir, '3Rs', 'error_no_layers')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Missing .?layers.? list")
ctx.clean_up()
def test_error_step_origin(test_dir):
ctx = context.TestContext(test_dir, 'bom', 'error_step_origin', None)
ctx = context.TestContext(test_dir, 'bom', 'error_step_origin')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Origin must be")
ctx.clean_up()
def test_error_step_min_distance(test_dir):
ctx = context.TestContext(test_dir, 'bom', 'error_step_min_distance', None)
ctx = context.TestContext(test_dir, 'bom', 'error_step_min_distance')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(".?min_distance.? must be a number")
ctx.clean_up()
def test_filter_not_list(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_filter_not_list', '')
ctx = context.TestContext(test_dir, PRJ, 'error_filter_not_list')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(r"Option .?filters.? must be a list\(dict\) not `dict`")
ctx.clean_up()
def test_filter_no_number_1(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_filter_no_number', '')
ctx = context.TestContext(test_dir, PRJ, 'error_filter_no_number')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Empty option .?number.?")
ctx.clean_up()
def test_filter_no_number_2(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_filter_no_number_2', '')
ctx = context.TestContext(test_dir, PRJ, 'error_filter_no_number_2')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Missing .?error.?")
ctx.clean_up()
def test_filter_no_regex_1(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_filter_no_regex', '')
ctx = context.TestContext(test_dir, PRJ, 'error_filter_no_regex')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Empty option .?regex.?")
ctx.clean_up()
def test_filter_wrong_entry(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_filter_wrong_entry', '')
ctx = context.TestContext(test_dir, PRJ, 'error_filter_wrong_entry')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown option .?numerito.?")
ctx.clean_up()
def test_error_pre_list(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_pre_list', '')
ctx = context.TestContext(test_dir, PRJ, 'error_pre_list')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Incorrect .?preflight.? section")
ctx.clean_up()
def test_error_pre_unk(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_pre_unk', '')
ctx = context.TestContext(test_dir, PRJ, 'error_pre_unk')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown preflight: .?run_drcs.?")
ctx.clean_up()
@ -326,7 +326,7 @@ def test_error_pre_unk(test_dir):
def test_error_wrong_type_1(test_dir):
""" run_drc = number """
ctx = context.TestContext(test_dir, PRJ, 'error_pre_wrong_type_1', '')
ctx = context.TestContext(test_dir, PRJ, 'error_pre_wrong_type_1')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("In preflight 'run_drc': must be boolean")
ctx.clean_up()
@ -334,7 +334,7 @@ def test_error_wrong_type_1(test_dir):
def test_error_wrong_type_2(test_dir):
""" ignore_unconnected = string """
ctx = context.TestContext(test_dir, PRJ, 'error_pre_wrong_type_2', '')
ctx = context.TestContext(test_dir, PRJ, 'error_pre_wrong_type_2')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("In preflight 'ignore_unconnected': must be boolean")
ctx.clean_up()
@ -342,7 +342,7 @@ def test_error_wrong_type_2(test_dir):
def test_error_wrong_type_3(test_dir):
""" run_erc = number """
ctx = context.TestContext(test_dir, PRJ, 'error_pre_wrong_type_3', '')
ctx = context.TestContext(test_dir, PRJ, 'error_pre_wrong_type_3')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("In preflight 'run_erc': must be boolean")
ctx.clean_up()
@ -350,7 +350,7 @@ def test_error_wrong_type_3(test_dir):
def test_error_wrong_type_4(test_dir):
""" update_xml = number """
ctx = context.TestContext(test_dir, PRJ, 'error_pre_wrong_type_4', '')
ctx = context.TestContext(test_dir, PRJ, 'error_pre_wrong_type_4')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("In preflight 'update_xml': must be boolean")
ctx.clean_up()
@ -358,63 +358,63 @@ def test_error_wrong_type_4(test_dir):
def test_error_wrong_type_5(test_dir):
""" check_zone_fills = number """
ctx = context.TestContext(test_dir, PRJ, 'error_pre_wrong_type_5', '')
ctx = context.TestContext(test_dir, PRJ, 'error_pre_wrong_type_5')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("In preflight 'check_zone_fills': must be boolean")
ctx.clean_up()
def test_error_yaml(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_yaml', '')
ctx = context.TestContext(test_dir, PRJ, 'error_yaml')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Error loading YAML")
ctx.clean_up()
def test_out_not_list(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_out_not_list', '')
ctx = context.TestContext(test_dir, PRJ, 'error_out_not_list')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(".?outputs.? must be a list")
ctx.clean_up()
def test_unk_section(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_unk_section', '')
ctx = context.TestContext(test_dir, PRJ, 'error_unk_section')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown section .?bogus.? in config")
ctx.clean_up()
def test_error_hpgl_pen_num(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_hpgl_pen_num', '')
ctx = context.TestContext(test_dir, PRJ, 'error_hpgl_pen_num')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Option .?pen_number.? outside its range")
ctx.clean_up()
def test_error_bom_wrong_format(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_bom_wrong_format', '')
ctx = context.TestContext(test_dir, PRJ, 'error_bom_wrong_format')
ctx.run(EXIT_BAD_CONFIG, no_board_file=True, extra=['-e', os.path.join(ctx.get_board_dir(), 'bom'+context.KICAD_SCH_EXT)])
assert ctx.search_err("Option .?format.? must be any of")
ctx.clean_up()
def test_error_bom_column(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_bom_column', '')
ctx = context.TestContext(test_dir, PRJ, 'error_bom_column')
ctx.run(EXIT_BAD_CONFIG, no_board_file=True, extra=['-e', os.path.join(ctx.get_board_dir(), 'bom'+context.KICAD_SCH_EXT)])
assert ctx.search_err("Invalid column name .?Impossible.?")
ctx.clean_up()
def test_error_bom_no_columns(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_bom_column', '')
ctx = context.TestContext(test_dir, PRJ, 'error_bom_column')
ctx.run(BOM_ERROR, no_board_file=True, extra=['-e', os.path.join(ctx.get_board_dir(), 'bom_no_xml'+context.KICAD_SCH_EXT)])
assert ctx.search_err("Failed to get the column names")
ctx.clean_up()
def test_error_bom_no_field(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_bom_no_field', '')
ctx = context.TestContext(test_dir, PRJ, 'error_bom_no_field')
ctx.run(EXIT_BAD_CONFIG, no_board_file=True, extra=['-e', os.path.join(ctx.get_board_dir(),
'fail-erc'+context.KICAD_SCH_EXT)])
assert ctx.search_err("Missing or empty .?field.?")
@ -422,21 +422,21 @@ def test_error_bom_no_field(test_dir):
def test_error_wrong_boolean(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_wrong_boolean', '')
ctx = context.TestContext(test_dir, PRJ, 'error_wrong_boolean')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(".?exclude_edge_layer.? must be a boolean")
ctx.clean_up()
def test_error_gerber_precision(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_gerber_precision', '')
ctx = context.TestContext(test_dir, PRJ, 'error_gerber_precision')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(".?gerber_precision.? must be 4.5 or 4.6")
ctx.clean_up()
def test_error_wrong_drill_marks_1(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_wrong_drill_marks', '')
ctx = context.TestContext(test_dir, PRJ, 'error_wrong_drill_marks')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(r"Option `drill_marks` must be any of \['none', 'small', 'full'\] not `bogus`")
ctx.clean_up()
@ -444,196 +444,196 @@ def test_error_wrong_drill_marks_1(test_dir):
def test_error_print_pcb_no_layer(test_dir):
prj = 'bom'
ctx = context.TestContext(test_dir, prj, 'error_print_pcb_no_layer', '')
ctx = context.TestContext(test_dir, prj, 'error_print_pcb_no_layer')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Missing .?layers.? list")
ctx.clean_up()
def test_error_color(test_dir):
ctx = context.TestContext(test_dir, 'bom', 'error_color', '')
ctx = context.TestContext(test_dir, 'bom', 'error_color')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Invalid color for .?board.?")
ctx.clean_up()
def test_wrong_global(test_dir):
ctx = context.TestContext(test_dir, 'bom', 'error_wrong_global', '')
ctx = context.TestContext(test_dir, 'bom', 'error_wrong_global')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Incorrect .?global.? section")
ctx.clean_up()
def test_goutput_not_string(test_dir):
ctx = context.TestContext(test_dir, 'bom', 'error_goutput_not_string', '')
ctx = context.TestContext(test_dir, 'bom', 'error_goutput_not_string')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Option .?output.? must be a string")
ctx.clean_up()
def test_unk_global(test_dir):
ctx = context.TestContext(test_dir, 'bom', 'error_unk_global', '')
ctx = context.TestContext(test_dir, 'bom', 'error_unk_global')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown global option")
ctx.clean_up()
def test_error_int_bom_no_field(test_dir):
ctx = context.TestContextSCH(test_dir, 'links', 'error_int_bom_no_field', '')
ctx = context.TestContextSCH(test_dir, 'links', 'error_int_bom_no_field')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Missing or empty `field` in columns list")
ctx.clean_up()
def test_error_int_bom_miss_logo(test_dir):
ctx = context.TestContextSCH(test_dir, 'links', 'error_int_bom_miss_logo', '')
ctx = context.TestContextSCH(test_dir, 'links', 'error_int_bom_miss_logo')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Missing logo file")
ctx.clean_up()
def test_error_int_bom_miss_style(test_dir):
ctx = context.TestContextSCH(test_dir, 'links', 'error_int_bom_miss_style', '')
ctx = context.TestContextSCH(test_dir, 'links', 'error_int_bom_miss_style')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Missing style file")
ctx.clean_up()
def test_error_int_bom_unknown_style(test_dir):
ctx = context.TestContextSCH(test_dir, 'links', 'error_int_bom_unknown_style', '')
ctx = context.TestContextSCH(test_dir, 'links', 'error_int_bom_unknown_style')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown style .?bogus.?")
ctx.clean_up()
def test_error_int_bom_invalid_col(test_dir):
ctx = context.TestContextSCH(test_dir, 'links', 'error_int_bom_invalid_col', '')
ctx = context.TestContextSCH(test_dir, 'links', 'error_int_bom_invalid_col')
ctx.run()
assert ctx.search_err("Invalid column name")
ctx.clean_up()
def test_error_int_bom_logo_format(test_dir):
ctx = context.TestContextSCH(test_dir, 'links', 'error_int_bom_logo_format', '')
ctx = context.TestContextSCH(test_dir, 'links', 'error_int_bom_logo_format')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Only PNG images are supported for the logo")
ctx.clean_up()
def test_error_var_no_name(test_dir):
ctx = context.TestContextSCH(test_dir, 'links', 'error_var_no_name', '')
ctx = context.TestContextSCH(test_dir, 'links', 'error_var_no_name')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Variant needs a name in:")
ctx.clean_up()
def test_error_var_empty_name(test_dir):
ctx = context.TestContextSCH(test_dir, 'links', 'error_var_empty_name', '')
ctx = context.TestContextSCH(test_dir, 'links', 'error_var_empty_name')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Variant needs a name in:")
ctx.clean_up()
def test_error_var_wrong_type(test_dir):
ctx = context.TestContextSCH(test_dir, 'links', 'error_var_wrong_type', '')
ctx = context.TestContextSCH(test_dir, 'links', 'error_var_wrong_type')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown variant type")
ctx.clean_up()
def test_error_var_no_type(test_dir):
ctx = context.TestContextSCH(test_dir, 'links', 'error_var_no_type', '')
ctx = context.TestContextSCH(test_dir, 'links', 'error_var_no_type')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Variant (.*) needs a type")
ctx.clean_up()
def test_error_var_empty_type(test_dir):
ctx = context.TestContextSCH(test_dir, 'links', 'error_var_empty_type', '')
ctx = context.TestContextSCH(test_dir, 'links', 'error_var_empty_type')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Variant (.*) needs a type")
ctx.clean_up()
def test_error_var_no_list(test_dir):
ctx = context.TestContextSCH(test_dir, 'links', 'error_var_no_list', '')
ctx = context.TestContextSCH(test_dir, 'links', 'error_var_no_list')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(".?variants.? must be a list")
ctx.clean_up()
def test_error_fil_no_list(test_dir):
ctx = context.TestContextSCH(test_dir, 'links', 'error_fil_no_list', '')
ctx = context.TestContextSCH(test_dir, 'links', 'error_fil_no_list')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(".?filters.? must be a list")
ctx.clean_up()
def test_error_fil_unknown(test_dir):
ctx = context.TestContextSCH(test_dir, 'links', 'error_fil_unknown', '')
ctx = context.TestContextSCH(test_dir, 'links', 'error_fil_unknown')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown filter (.*) used for ")
ctx.clean_up()
def test_error_var_unknown(test_dir):
ctx = context.TestContextSCH(test_dir, 'links', 'error_unk_variant', '')
ctx = context.TestContextSCH(test_dir, '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(test_dir):
ctx = context.TestContextSCH(test_dir, 'links', 'error_wrong_fil_name', '')
ctx = context.TestContextSCH(test_dir, 'links', 'error_wrong_fil_name')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Filter names starting with (.*) are reserved")
ctx.clean_up()
def test_error_pcbdraw_comp_key(test_dir):
ctx = context.TestContext(test_dir, 'bom', 'error_pcbdraw_comp_key', '')
ctx = context.TestContext(test_dir, 'bom', 'error_pcbdraw_comp_key')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Option .?show_components.? must be any of")
ctx.clean_up()
def test_error_rot_not_two(test_dir):
ctx = context.TestContext(test_dir, 'bom', 'error_rot_not_two', '')
ctx = context.TestContext(test_dir, 'bom', 'error_rot_not_two')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Each regex/angle pair must contain exactly two values")
ctx.clean_up()
def test_error_rot_not_number(test_dir):
ctx = context.TestContext(test_dir, 'bom', 'error_rot_not_number', '')
ctx = context.TestContext(test_dir, 'bom', 'error_rot_not_number')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("The second value in the regex/angle pairs must be a number")
ctx.clean_up()
def test_error_rot_no_rotations(test_dir):
ctx = context.TestContext(test_dir, 'bom', 'error_rot_no_rotations', '')
ctx = context.TestContext(test_dir, 'bom', 'error_rot_no_rotations')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("No rotations provided")
ctx.clean_up()
def test_error_makefile_wrong_out(test_dir):
ctx = context.TestContext(test_dir, 'bom', 'error_makefile_wrong_out', '')
ctx = context.TestContext(test_dir, 'bom', 'error_makefile_wrong_out')
ctx.run(WRONG_ARGUMENTS)
assert ctx.search_err("Unknown output `position` selected in")
ctx.clean_up()
def test_error_no_column_id(test_dir):
ctx = context.TestContext(test_dir, 'bom', 'error_no_column_id', '')
ctx = context.TestContext(test_dir, 'bom', 'error_no_column_id')
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, 'bom', 'error_aggregate_no_file', '')
ctx = context.TestContext(test_dir, 'bom', 'error_aggregate_no_file')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Missing or empty `file` in aggregate list")
ctx.clean_up()
@ -650,28 +650,28 @@ def test_error_aggregate_miss_file(test_dir):
def test_error_wrong_import_type(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_wrong_import_type', '')
ctx = context.TestContext(test_dir, PRJ, 'error_wrong_import_type')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(r"Incorrect `import` section \(must be a list\)")
ctx.clean_up()
def test_error_import_not_str(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_import_not_str', '')
ctx = context.TestContext(test_dir, PRJ, 'error_import_not_str')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(r"`import` items must be strings")
ctx.clean_up()
def test_error_import_miss_file(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_import_miss_file', '')
ctx = context.TestContext(test_dir, PRJ, 'error_import_miss_file')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(r"missing import file")
ctx.clean_up()
def test_error_import_no_outputs(test_dir):
ctx = context.TestContext(test_dir, PRJ, 'error_import_no_outputs', '')
ctx = context.TestContext(test_dir, PRJ, 'error_import_no_outputs')
ctx.run()
assert ctx.search_err(r"No outputs found in `(.*)drc.kibot.yaml`")
ctx.clean_up()
@ -679,7 +679,7 @@ def test_error_import_no_outputs(test_dir):
def test_same_name_1(test_dir):
""" 2 outputs with the same name in the same file """
ctx = context.TestContext(test_dir, PRJ, 'error_same_name_1', '')
ctx = context.TestContext(test_dir, PRJ, 'error_same_name_1')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(r"Output name `position` already defined")
ctx.clean_up()
@ -687,7 +687,7 @@ def test_same_name_1(test_dir):
def test_same_name_2(test_dir):
""" Using import, but the 2nd is in the main file """
ctx = context.TestContext(test_dir, PRJ, 'error_same_name_2', '')
ctx = context.TestContext(test_dir, PRJ, 'error_same_name_2')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(r"Output name `position` already defined")
ctx.clean_up()
@ -695,7 +695,7 @@ def test_same_name_2(test_dir):
def test_same_name_3(test_dir):
""" Using import and the 2nd is from the import """
ctx = context.TestContext(test_dir, PRJ, 'error_same_name_3', '')
ctx = context.TestContext(test_dir, PRJ, 'error_same_name_3')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(r"Output name `position` already defined, while importing from")
ctx.clean_up()
@ -703,7 +703,7 @@ def test_same_name_3(test_dir):
def test_extends_1(test_dir):
""" Extend an undefined output """
ctx = context.TestContext(test_dir, PRJ, 'error_extends_1', '')
ctx = context.TestContext(test_dir, PRJ, 'error_extends_1')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err(r"In section 'position_mine' \(position\): Unknown output `position2` in `extends`")
ctx.clean_up()