Simplified the tests
This commit is contained in:
parent
a7a50dcf6d
commit
3a5042ea96
|
|
@ -0,0 +1,12 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context # noqa: F401
|
||||
prev_dir = os.path.dirname(prev_dir)
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
|
|
@ -11,17 +11,8 @@ pytest-3 --log-cli-level debug
|
|||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
prev_dir = os.path.dirname(prev_dir)
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
from kibot.misc import (BOM_ERROR)
|
||||
from . import context
|
||||
from kibot.misc import BOM_ERROR
|
||||
|
||||
BOM_DIR = 'BoM'
|
||||
|
||||
|
|
@ -32,18 +23,17 @@ def test_bom_ok(test_dir):
|
|||
ctx.run()
|
||||
# Check all outputs are there
|
||||
# Default format is PRJ_bom_REVISION
|
||||
name = os.path.join(BOM_DIR, prj)
|
||||
csv = name+'-bom.csv'
|
||||
html = name+'_bom_r1_(pp).html'
|
||||
ctx.expect_out_file(csv)
|
||||
ctx.expect_out_file(html)
|
||||
ctx.search_in_file(csv, ['R,R1,100', 'R,R2,200', 'C,C1,1uF'])
|
||||
os.remove(os.path.join(ctx.get_board_dir(), 'bom.ini'))
|
||||
csv = prj+'-bom.csv'
|
||||
html = prj+'_bom_r1_(pp).html'
|
||||
ctx.expect_out_file_d(csv)
|
||||
ctx.expect_out_file_d(html)
|
||||
ctx.search_in_file_d(csv, ['R,R1,100', 'R,R2,200', 'C,C1,1uF'])
|
||||
os.remove(ctx.get_board_dir('bom.ini'))
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_bom_fail(test_dir):
|
||||
ctx = context.TestContext(test_dir, 'bom_no_xml', 'bom', BOM_DIR)
|
||||
ctx = context.TestContext(test_dir, 'bom_no_xml', 'bom')
|
||||
ctx.run(BOM_ERROR)
|
||||
ctx.clean_up()
|
||||
|
||||
|
|
@ -52,10 +42,9 @@ def test_bom_cfg_1(test_dir):
|
|||
prj = 'bom'
|
||||
ctx = context.TestContextSCH(test_dir, prj, 'bom_cfg', BOM_DIR)
|
||||
ctx.run()
|
||||
name = os.path.join(BOM_DIR, prj)
|
||||
csv = name+'-bom.csv'
|
||||
ctx.expect_out_file(csv)
|
||||
ctx.search_in_file(csv, ['R,R1,100 R_0805_2012Metric ~', 'R,R2,200 R_0805_2012Metric ~', 'C,C1,1uF C_0805_2012Metric ~'])
|
||||
csv = prj+'-bom.csv'
|
||||
ctx.expect_out_file_d(csv)
|
||||
ctx.search_in_file_d(csv, ['R,R1,100 R_0805_2012Metric ~', 'R,R2,200 R_0805_2012Metric ~', 'C,C1,1uF C_0805_2012Metric ~'])
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -63,11 +52,10 @@ def test_bom_cfg_2(test_dir):
|
|||
prj = 'bom'
|
||||
ctx = context.TestContextSCH(test_dir, prj, 'bom_cfg2', BOM_DIR)
|
||||
ctx.run()
|
||||
name = os.path.join(BOM_DIR, prj)
|
||||
csv = name+'-bom.csv'
|
||||
ctx.expect_out_file(csv)
|
||||
ctx.search_in_file(csv, ['R,100 R_0805_2012Metric,R1', 'R,200 R_0805_2012Metric,R2'])
|
||||
ctx.search_not_in_file(csv, ['C,1uF C_0805_2012Metric,C1'])
|
||||
csv = prj+'-bom.csv'
|
||||
ctx.expect_out_file_d(csv)
|
||||
ctx.search_in_file_d(csv, ['R,100 R_0805_2012Metric,R1', 'R,200 R_0805_2012Metric,R2'])
|
||||
ctx.search_not_in_file_d(csv, ['C,1uF C_0805_2012Metric,C1'])
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -76,10 +64,9 @@ def test_bom_cfg_3(test_dir):
|
|||
prj = 'bom'
|
||||
ctx = context.TestContextSCH(test_dir, prj, 'bom_cfg3', BOM_DIR)
|
||||
ctx.run()
|
||||
name = os.path.join(BOM_DIR, prj)
|
||||
csv = name+'-bom.csv'
|
||||
ctx.expect_out_file(csv)
|
||||
ctx.search_in_file(csv, ['R,R1,100', 'R,R2,200', 'C,C1,1uF'])
|
||||
csv = prj+'-bom.csv'
|
||||
ctx.expect_out_file_d(csv)
|
||||
ctx.search_in_file_d(csv, ['R,R1,100', 'R,R2,200', 'C,C1,1uF'])
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -88,8 +75,7 @@ def test_bom_cfg_4(test_dir):
|
|||
prj = 'bom'
|
||||
ctx = context.TestContext(test_dir, prj, 'bom_cfg4', BOM_DIR)
|
||||
ctx.run()
|
||||
name = os.path.join(BOM_DIR, prj)
|
||||
csv = name+'-bom.csv'
|
||||
ctx.expect_out_file(csv)
|
||||
ctx.search_in_file(csv, ['R,100,R1', 'R,200,R2', 'C,1uF,C1'])
|
||||
csv = prj+'-bom.csv'
|
||||
ctx.expect_out_file_d(csv)
|
||||
ctx.search_in_file_d(csv, ['R,100,R1', 'R,200,R2', 'C,1uF,C1'])
|
||||
ctx.clean_up()
|
||||
|
|
|
|||
|
|
@ -12,12 +12,7 @@ pytest-3 --log-cli-level debug
|
|||
|
||||
import os
|
||||
import sys
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
from . import context
|
||||
|
||||
DRILL_DIR = 'Drill'
|
||||
positions = {'R1': (105, 35, 'top'), 'R2': (110, 35, 'bottom'), 'R3': (110, 45, 'top')}
|
||||
|
|
|
|||
|
|
@ -4,17 +4,7 @@ Tests of DXF format.
|
|||
For debug information use:
|
||||
pytest-3 --log-cli-level debug
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
|
||||
|
||||
from . import context
|
||||
PS_DIR = 'DXF'
|
||||
|
||||
|
||||
|
|
@ -22,11 +12,7 @@ def test_dxf(test_dir):
|
|||
prj = 'simple_2layer'
|
||||
ctx = context.TestContext(test_dir, prj, 'dxf', PS_DIR)
|
||||
ctx.run()
|
||||
|
||||
f_cu = ctx.get_gerber_filename('F_Cu', '.dxf')
|
||||
f_fab = ctx.get_gerber_filename('F_Fab', '.dxf')
|
||||
ctx.expect_out_file(f_cu)
|
||||
ctx.expect_out_file(f_fab)
|
||||
ctx.expect_out_file(ctx.get_gerber_filename('F_Cu', '.dxf'))
|
||||
ctx.expect_out_file(ctx.get_gerber_filename('F_Fab', '.dxf'))
|
||||
ctx.dont_expect_out_file(ctx.get_gerber_job_filename())
|
||||
|
||||
ctx.clean_up()
|
||||
|
|
|
|||
|
|
@ -8,13 +8,7 @@ pytest-3 --log-cli-level debug
|
|||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
from . import context
|
||||
from kibot.misc import PLOT_ERROR
|
||||
from kibot.layer import Layer
|
||||
from kibot.gs import GS
|
||||
|
|
@ -101,7 +95,7 @@ def test_gerber_2layer(test_dir):
|
|||
r"R,2.000000X2.000000",
|
||||
r"C,1.000000"])
|
||||
|
||||
# expect a flash for the square pad
|
||||
# Expect a flash for the square pad
|
||||
ctx.expect_gerber_flash_at(f_cu, 5, (140, -100))
|
||||
|
||||
ctx.clean_up()
|
||||
|
|
@ -114,16 +108,15 @@ def test_gerber_inner_ok(test_dir):
|
|||
ctx.create_dummy_out_file(rarfile)
|
||||
ctx.run()
|
||||
files = [prj+'_GND_Cu.gbr', prj+'_Signal1.gbr', 'test-'+prj+'.gbrjob']
|
||||
files = [os.path.join(GERBER_DIR, f) for f in files]
|
||||
for f in files:
|
||||
ctx.expect_out_file(f)
|
||||
ctx.test_compress(rarfile, files)
|
||||
ctx.expect_out_file_d(f)
|
||||
ctx.test_compress_d(rarfile, files)
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_gerber_inner_wrong(test_dir):
|
||||
prj = 'good-project'
|
||||
ctx = context.TestContext(test_dir, prj, 'gerber_inner_wrong', GERBER_DIR)
|
||||
ctx = context.TestContext(test_dir, prj, 'gerber_inner_wrong')
|
||||
ctx.run(PLOT_ERROR)
|
||||
assert ctx.search_err('is not valid for this board')
|
||||
ctx.clean_up()
|
||||
|
|
@ -152,7 +145,7 @@ def check_components(ctx, dir, prefix, layers, suffix, exclude, include):
|
|||
|
||||
def test_gerber_variant_1(test_dir):
|
||||
prj = 'kibom-variant_3'
|
||||
ctx = context.TestContext(test_dir, prj, 'gerber_variant_1', GERBER_DIR)
|
||||
ctx = context.TestContext(test_dir, prj, 'gerber_variant_1')
|
||||
ctx.run()
|
||||
# R3 is a component added to the PCB, included in all cases
|
||||
# variant: default directory: gerber components: R1, R2 and R3
|
||||
|
|
@ -173,7 +166,7 @@ def test_gerber_protel_1(test_dir):
|
|||
ctx.run()
|
||||
exts = ALL_EXTS+INNER_EXTS
|
||||
for n, suf in enumerate(ALL_LAYERS+INNER_LAYERS):
|
||||
ctx.expect_out_file(os.path.join(GERBER_DIR, prj+'_'+suf+'.'+exts[n]))
|
||||
ctx.expect_out_file_d(prj+'_'+suf+'.'+exts[n])
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -188,11 +181,10 @@ def test_gerber_protel_2(test_dir):
|
|||
ext = exts[n]
|
||||
if ext == 'gm1':
|
||||
ext = 'e_cut'
|
||||
file = os.path.join(GERBER_DIR, prj+'_'+suf+'.'+ext.upper())
|
||||
ctx.expect_out_file(file)
|
||||
file = prj+'_'+suf+'.'+ext.upper()
|
||||
ctx.expect_out_file_d(file)
|
||||
files.append(file)
|
||||
assert ctx.search_err('Layer "Inner layer 6" isn\'t used')
|
||||
ctx.search_in_file(os.path.join(GERBER_DIR, 'Report.txt'),
|
||||
['Top layer: good-project_F_Cu.GTL', 'Basename: good-project'])
|
||||
ctx.test_compress(prj+'-result.tar.gz', files)
|
||||
ctx.search_in_file_d('Report.txt', ['Top layer: good-project_F_Cu.GTL', 'Basename: good-project'])
|
||||
ctx.test_compress_d(prj+'-result.tar.gz', files)
|
||||
ctx.clean_up()
|
||||
|
|
|
|||
|
|
@ -4,17 +4,7 @@ Tests of HPGL format.
|
|||
For debug information use:
|
||||
pytest-3 --log-cli-level debug
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
|
||||
|
||||
from . import context
|
||||
PS_DIR = 'HPGL'
|
||||
|
||||
|
||||
|
|
@ -22,13 +12,9 @@ def test_hpgl(test_dir):
|
|||
prj = 'simple_2layer'
|
||||
ctx = context.TestContext(test_dir, prj, 'hpgl', PS_DIR)
|
||||
ctx.run()
|
||||
|
||||
f_cu = ctx.get_gerber_filename('F_Cu', '.plt')
|
||||
f_silk = ctx.get_gerber_filename('B_Silks', '.plt')
|
||||
ctx.expect_out_file(f_cu)
|
||||
ctx.expect_out_file(f_silk)
|
||||
ctx.expect_out_file(ctx.get_gerber_filename('F_Cu', '.plt'))
|
||||
ctx.expect_out_file(ctx.get_gerber_filename('B_Silks', '.plt'))
|
||||
ctx.dont_expect_out_file(ctx.get_gerber_job_filename())
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -36,10 +22,8 @@ def test_hpgl_auto(test_dir):
|
|||
prj = 'simple_2layer'
|
||||
ctx = context.TestContext(test_dir, prj, 'hpgl_auto', PS_DIR)
|
||||
ctx.run()
|
||||
f_cu = ctx.get_gerber_filename('F_Cu', '.plt')
|
||||
f_silk = ctx.get_gerber_filename('B_Silks', '.plt')
|
||||
ctx.expect_out_file(f_cu)
|
||||
ctx.expect_out_file(f_silk)
|
||||
ctx.expect_out_file(ctx.get_gerber_filename('F_Cu', '.plt'))
|
||||
ctx.expect_out_file(ctx.get_gerber_filename('B_Silks', '.plt'))
|
||||
ctx.dont_expect_out_file(ctx.get_gerber_job_filename())
|
||||
ctx.search_err(r'Only ASCII chars are allowed for layer suffixes')
|
||||
ctx.clean_up()
|
||||
|
|
|
|||
|
|
@ -9,22 +9,12 @@ For debug information use:
|
|||
pytest-3 --log-cli-level debug
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import json
|
||||
import logging
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
from . import context
|
||||
from utils.lzstring import LZString
|
||||
prev_dir = os.path.dirname(prev_dir)
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
from kibot.misc import (BOM_ERROR)
|
||||
|
||||
BOM_DIR = 'BoM'
|
||||
|
|
@ -58,9 +48,7 @@ def test_ibom_1(test_dir):
|
|||
ctx.run()
|
||||
# Check all outputs are there
|
||||
# We use this format: %f_iBoM
|
||||
name = os.path.join(BOM_DIR, prj+'_iBoM')
|
||||
html = name+'.html'
|
||||
ctx.expect_out_file(html)
|
||||
ctx.expect_out_file_d(prj+'_iBoM.html')
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -68,14 +56,13 @@ def test_ibom_no_ops(test_dir):
|
|||
prj = 'bom'
|
||||
ctx = context.TestContext(test_dir, prj, 'ibom_no_ops', BOM_DIR)
|
||||
ctx.run()
|
||||
fname = os.path.join(BOM_DIR, IBOM_OUT)
|
||||
ctx.expect_out_file(fname)
|
||||
ctx.expect_out_file_d(IBOM_OUT)
|
||||
check_modules(ctx, IBOM_OUT, ['C1', 'R1', 'R2'])
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_ibom_fail(test_dir):
|
||||
ctx = context.TestContext(test_dir, 'ibom_fail', 'ibom', BOM_DIR)
|
||||
ctx = context.TestContext(test_dir, 'ibom_fail', 'ibom')
|
||||
ctx.run(BOM_ERROR)
|
||||
ctx.clean_up()
|
||||
|
||||
|
|
@ -84,20 +71,19 @@ def test_ibom_all_ops(test_dir):
|
|||
prj = 'bom'
|
||||
ctx = context.TestContext(test_dir, prj, 'ibom_all_ops', BOM_DIR, add_cfg_kmajor=True)
|
||||
ctx.run()
|
||||
out = os.path.join(BOM_DIR, IBOM_OUT)
|
||||
ctx.expect_out_file(out)
|
||||
ctx.expect_out_file_d(IBOM_OUT)
|
||||
# These options are transferred as defaults:
|
||||
ctx.search_in_file(out, [r'"dark_mode": true',
|
||||
r'"show_pads": false',
|
||||
r'"show_fabrication": true',
|
||||
r'"show_silkscreen": false',
|
||||
r'"highlight_pin1": true',
|
||||
r'"redraw_on_drag": false',
|
||||
r'"board_rotation": 18.0', # 90/5
|
||||
r'"checkboxes": "Sourced,Placed,Bogus"',
|
||||
r'"bom_view": "top-bottom"',
|
||||
r'"layer_view": "B"',
|
||||
r'"fields": \["Value", "Footprint", "EF"\]'])
|
||||
ctx.search_in_file_d(IBOM_OUT, [r'"dark_mode": true',
|
||||
r'"show_pads": false',
|
||||
r'"show_fabrication": true',
|
||||
r'"show_silkscreen": false',
|
||||
r'"highlight_pin1": true',
|
||||
r'"redraw_on_drag": false',
|
||||
r'"board_rotation": 18.0', # 90/5
|
||||
r'"checkboxes": "Sourced,Placed,Bogus"',
|
||||
r'"bom_view": "top-bottom"',
|
||||
r'"layer_view": "B"',
|
||||
r'"fields": \["Value", "Footprint", "EF"\]'])
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -49,18 +49,9 @@ pytest-3 --log-cli-level debug
|
|||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
from base64 import b64decode
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
prev_dir = os.path.dirname(prev_dir)
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
from . import context
|
||||
from kibot.misc import EXIT_BAD_CONFIG
|
||||
|
||||
BOM_DIR = 'BoM'
|
||||
|
|
@ -270,7 +261,7 @@ def kibom_setup(test_dir, test, ext='csv'):
|
|||
prj = 'kibom-test'
|
||||
ctx = context.TestContextSCH(test_dir, prj, test, BOM_DIR, test_name=test)
|
||||
ctx.run()
|
||||
out = prj + '-bom.' + ext
|
||||
out = prj+'-bom.'+ext
|
||||
return ctx, out
|
||||
|
||||
|
||||
|
|
@ -280,7 +271,7 @@ def test_int_bom_simple_csv(test_dir):
|
|||
check_csv_info(info, KIBOM_PRJ_INFO, KIBOM_STATS)
|
||||
kibom_verif(rows, header)
|
||||
# Check not quoted and comma as delimiter
|
||||
ctx.search_in_file(os.path.join(BOM_DIR, out), [KIBOM_TEST_HEAD[0]+','+KIBOM_TEST_HEAD[1]])
|
||||
ctx.search_in_file_d(out, [KIBOM_TEST_HEAD[0]+','+KIBOM_TEST_HEAD[1]])
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -291,7 +282,7 @@ def test_int_bom_csv_no_info(test_dir):
|
|||
check_csv_info(info, None, KIBOM_STATS)
|
||||
kibom_verif(rows, header)
|
||||
# Check not quoted and comma as delimiter
|
||||
ctx.search_in_file(os.path.join(BOM_DIR, out), [KIBOM_TEST_HEAD[0]+','+KIBOM_TEST_HEAD[1]])
|
||||
ctx.search_in_file_d(out, [KIBOM_TEST_HEAD[0]+','+KIBOM_TEST_HEAD[1]])
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -302,7 +293,7 @@ def test_int_bom_csv_no_stats(test_dir):
|
|||
check_csv_info(info, KIBOM_PRJ_INFO, None)
|
||||
kibom_verif(rows, header)
|
||||
# Check not quoted and comma as delimiter
|
||||
ctx.search_in_file(os.path.join(BOM_DIR, out), [KIBOM_TEST_HEAD[0]+','+KIBOM_TEST_HEAD[1]])
|
||||
ctx.search_in_file_d(out, [KIBOM_TEST_HEAD[0]+','+KIBOM_TEST_HEAD[1]])
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -313,7 +304,7 @@ def test_int_bom_csv_no_extra(test_dir):
|
|||
assert len(info) == 0
|
||||
kibom_verif(rows, header)
|
||||
# Check not quoted and comma as delimiter
|
||||
ctx.search_in_file(os.path.join(BOM_DIR, out), [KIBOM_TEST_HEAD[0]+','+KIBOM_TEST_HEAD[1]])
|
||||
ctx.search_in_file_d(out, [KIBOM_TEST_HEAD[0]+','+KIBOM_TEST_HEAD[1]])
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -322,7 +313,7 @@ def test_int_bom_refuse_no_sep(test_dir):
|
|||
rows, header, info = ctx.load_csv(out)
|
||||
kibom_verif(rows, header)
|
||||
# Check not quoted and comma as delimiter
|
||||
ctx.search_in_file(os.path.join(BOM_DIR, out), ['"'+KIBOM_TEST_HEAD[0]+'","'+KIBOM_TEST_HEAD[1]+'"'])
|
||||
ctx.search_in_file_d(out, ['"'+KIBOM_TEST_HEAD[0]+'","'+KIBOM_TEST_HEAD[1]+'"'])
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -332,7 +323,7 @@ def test_int_bom_simple_txt(test_dir):
|
|||
kibom_verif(rows, header)
|
||||
check_csv_info(info, KIBOM_PRJ_INFO, KIBOM_STATS)
|
||||
# Check all quoted and tab as delimiter
|
||||
ctx.search_in_file(os.path.join(BOM_DIR, out), ['"'+KIBOM_TEST_HEAD[0]+'"\t"'+KIBOM_TEST_HEAD[1]+'"'])
|
||||
ctx.search_in_file_d(out, ['"'+KIBOM_TEST_HEAD[0]+'"\t"'+KIBOM_TEST_HEAD[1]+'"'])
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -1611,7 +1602,7 @@ def test_int_bom_merge_xml_1(test_dir):
|
|||
|
||||
def test_int_bom_subparts_1(test_dir):
|
||||
prj = 'subparts'
|
||||
ctx = context.TestContextSCH(test_dir, prj, 'int_bom_subparts_1', '')
|
||||
ctx = context.TestContextSCH(test_dir, prj, 'int_bom_subparts_1')
|
||||
ctx.run(extra_debug=True)
|
||||
output = prj+'-bom.csv'
|
||||
ctx.expect_out_file(output)
|
||||
|
|
@ -1621,7 +1612,7 @@ def test_int_bom_subparts_1(test_dir):
|
|||
|
||||
def test_int_bom_subparts_2(test_dir):
|
||||
prj = 'subparts_rename'
|
||||
ctx = context.TestContextSCH(test_dir, prj, 'int_bom_subparts_2', '')
|
||||
ctx = context.TestContextSCH(test_dir, prj, 'int_bom_subparts_2')
|
||||
ctx.run(extra_debug=True)
|
||||
output = prj+'-bom.csv'
|
||||
ctx.expect_out_file(output)
|
||||
|
|
@ -1631,7 +1622,7 @@ def test_int_bom_subparts_2(test_dir):
|
|||
|
||||
def test_int_bom_subparts_3(test_dir):
|
||||
prj = 'subparts_rename'
|
||||
ctx = context.TestContextSCH(test_dir, prj, 'int_bom_subparts_3', '')
|
||||
ctx = context.TestContextSCH(test_dir, prj, 'int_bom_subparts_3')
|
||||
ctx.run(extra_debug=True)
|
||||
output = prj+'-bom.csv'
|
||||
ctx.expect_out_file(output)
|
||||
|
|
|
|||
|
|
@ -12,22 +12,12 @@ pytest-3 --log-cli-level debug
|
|||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import pytest
|
||||
import coverage
|
||||
import logging
|
||||
import sysconfig
|
||||
from subprocess import run, STDOUT, PIPE
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
# One more level for the project
|
||||
prev_dir = os.path.dirname(prev_dir)
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
from . import context
|
||||
from kibot.misc import EXIT_BAD_CONFIG
|
||||
from kibot.kicad.config import KiConf
|
||||
from kibot.gs import GS
|
||||
|
|
@ -44,7 +34,7 @@ def test_kicad_conf_bad_sym_lib_table(test_dir):
|
|||
# All data is in the Schematic file.
|
||||
return
|
||||
sch = 'sym-lib-table_errors/kibom-test'
|
||||
ctx = context.TestContextSCH(test_dir, sch, 'int_bom_simple_csv', None)
|
||||
ctx = context.TestContextSCH(test_dir, sch, 'int_bom_simple_csv')
|
||||
ctx.run(EXIT_BAD_CONFIG, extra_debug=True)
|
||||
ctx.search_err('Malformed lib entry')
|
||||
ctx.search_err(r'Unable to expand .?BOGUS.? in')
|
||||
|
|
|
|||
|
|
@ -4,24 +4,17 @@ Tests for the KiCost output.
|
|||
For debug information use:
|
||||
pytest-3 --log-cli-level debug
|
||||
"""
|
||||
|
||||
import os.path as op
|
||||
import sys
|
||||
import re
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = op.dirname(op.dirname(op.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
from . import context
|
||||
import logging
|
||||
import subprocess
|
||||
|
||||
|
||||
OUT_DIR = 'KiCost'
|
||||
|
||||
|
||||
def convert2csv(xlsx, skip_empty=False, sheet=None):
|
||||
def convert2csv(ctx, xlsx, skip_empty=False, sheet=None):
|
||||
xlsx = ctx.get_out_path(op.join(OUT_DIR, xlsx))
|
||||
csv = xlsx[:-4]+'csv'
|
||||
logging.debug('Converting to CSV')
|
||||
cmd = ['xlsx2csv']
|
||||
|
|
@ -45,11 +38,10 @@ def convert2csv(xlsx, skip_empty=False, sheet=None):
|
|||
def check_simple(ctx, variant):
|
||||
if variant:
|
||||
variant = '_'+variant
|
||||
name = op.join(OUT_DIR, 'simple'+variant+'.xlsx')
|
||||
ctx.expect_out_file(name)
|
||||
xlsx = ctx.get_out_path(name)
|
||||
convert2csv(xlsx, skip_empty=True)
|
||||
ctx.compare_txt(name[:-4]+'csv')
|
||||
name = 'simple'+variant+'.xlsx'
|
||||
ctx.expect_out_file_d(name)
|
||||
convert2csv(ctx, name, skip_empty=True)
|
||||
ctx.compare_txt_d2(name[:-4]+'csv')
|
||||
|
||||
|
||||
def test_kicost_simple(test_dir):
|
||||
|
|
@ -81,17 +73,17 @@ def test_kicost_bom_simple(test_dir):
|
|||
prj = 'kibom-variant_2c'
|
||||
ctx = context.TestContextSCH(test_dir, prj, 'int_bom_kicost_simple_xlsx', OUT_DIR)
|
||||
ctx.run(kicost=True) # , extra_debug=True
|
||||
output = op.join(OUT_DIR, prj+'-bom.xlsx')
|
||||
ctx.expect_out_file(output)
|
||||
convert2csv(ctx.get_out_path(output), sheet='Costs')
|
||||
output = prj+'-bom.xlsx'
|
||||
ctx.expect_out_file_d(output)
|
||||
convert2csv(ctx, output, sheet='Costs')
|
||||
csv = output[:-4]+'csv'
|
||||
ctx.compare_txt(csv)
|
||||
convert2csv(ctx.get_out_path(output), sheet='Costs (DNF)')
|
||||
ctx.compare_txt(csv, output[:-5]+'_dnf.csv')
|
||||
convert2csv(ctx.get_out_path(output), sheet='Specs')
|
||||
ctx.compare_txt(csv, output[:-5]+'_spec.csv')
|
||||
convert2csv(ctx.get_out_path(output), sheet='Specs (DNF)')
|
||||
ctx.compare_txt(csv, output[:-5]+'_spec_dnf.csv')
|
||||
ctx.compare_txt_d2(csv)
|
||||
convert2csv(ctx, output, sheet='Costs (DNF)')
|
||||
ctx.compare_txt_d2(csv, output[:-5]+'_dnf.csv')
|
||||
convert2csv(ctx, output, sheet='Specs')
|
||||
ctx.compare_txt_d2(csv, output[:-5]+'_spec.csv')
|
||||
convert2csv(ctx, output, sheet='Specs (DNF)')
|
||||
ctx.compare_txt_d2(csv, output[:-5]+'_spec_dnf.csv')
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -100,13 +92,13 @@ def test_kicost_bom_sel_dist_1(test_dir):
|
|||
prj = 'kibom-variant_2c'
|
||||
ctx = context.TestContextSCH(test_dir, prj, 'int_bom_kicost_sel_dist_1_xlsx', OUT_DIR)
|
||||
ctx.run(kicost=True, extra_debug=True) # , extra_debug=True
|
||||
output = op.join(OUT_DIR, prj+'-bom.xlsx')
|
||||
ctx.expect_out_file(output)
|
||||
convert2csv(ctx.get_out_path(output), sheet='Costs')
|
||||
output = prj+'-bom.xlsx'
|
||||
ctx.expect_out_file_d(output)
|
||||
convert2csv(ctx, output, sheet='Costs')
|
||||
csv = output[:-4]+'csv'
|
||||
ctx.compare_txt(csv, output[:-5]+'_dk_mou.csv')
|
||||
convert2csv(ctx.get_out_path(output), sheet='Costs (DNF)')
|
||||
ctx.compare_txt(csv, output[:-5]+'_dk_mou_dnf.csv')
|
||||
ctx.compare_txt_d2(csv, output[:-5]+'_dk_mou.csv')
|
||||
convert2csv(ctx, output, sheet='Costs (DNF)')
|
||||
ctx.compare_txt_d2(csv, output[:-5]+'_dk_mou_dnf.csv')
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -118,8 +110,8 @@ def test_kicost_bom_merge_1(test_dir):
|
|||
yaml += '_k6'
|
||||
ctx = context.TestContextSCH(test_dir, prj, yaml, OUT_DIR)
|
||||
ctx.run(kicost=True) # , extra_debug=True
|
||||
output = op.join(OUT_DIR, prj+'-bom.xlsx')
|
||||
ctx.expect_out_file(output)
|
||||
convert2csv(ctx.get_out_path(output), sheet='Costs')
|
||||
output = prj+'-bom.xlsx'
|
||||
ctx.expect_out_file_d(output)
|
||||
convert2csv(ctx, output, sheet='Costs')
|
||||
csv = output[:-4]+'csv'
|
||||
ctx.compare_txt(csv)
|
||||
ctx.compare_txt_d2(csv)
|
||||
|
|
|
|||
|
|
@ -27,23 +27,13 @@ Tests miscellaneous stuff.
|
|||
For debug information use:
|
||||
pytest-3 --log-cli-level debug
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import shutil
|
||||
import logging
|
||||
import subprocess
|
||||
import json
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
prev_dir = os.path.dirname(prev_dir)
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
from . import context
|
||||
from kibot.misc import (EXIT_BAD_ARGS, EXIT_BAD_CONFIG, NO_PCB_FILE, NO_SCH_FILE, EXAMPLE_CFG, WONT_OVERWRITE, CORRUPTED_PCB,
|
||||
PCBDRAW_ERR, NO_PCBNEW_MODULE, NO_YAML_MODULE, INTERNAL_ERROR)
|
||||
|
||||
|
|
@ -58,11 +48,9 @@ def test_skip_pre_and_outputs(test_dir):
|
|||
prj = 'simple_2layer'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position', POS_DIR)
|
||||
ctx.run(extra=['-s', 'all', '-i'])
|
||||
|
||||
ctx.dont_expect_out_file(ctx.get_pos_both_csv_filename())
|
||||
assert ctx.search_err('Skipping all preflight actions')
|
||||
assert ctx.search_err('Skipping all outputs')
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -70,13 +58,11 @@ def test_skip_pre_and_outputs_2(test_dir):
|
|||
prj = 'simple_2layer'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position', POS_DIR)
|
||||
ctx.run(extra=['-s', 'run_erc,update_xml,run_drc', '-i'])
|
||||
|
||||
ctx.dont_expect_out_file(ctx.get_pos_both_csv_filename())
|
||||
assert ctx.search_err('Skipping .?run_erc')
|
||||
assert ctx.search_err('Skipping .?run_drc')
|
||||
assert ctx.search_err('Skipping .?update_xml')
|
||||
assert ctx.search_err('Skipping all outputs')
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -84,10 +70,8 @@ def test_skip_pre_and_outputs_3(test_dir):
|
|||
prj = 'simple_2layer'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position', POS_DIR)
|
||||
ctx.run(EXIT_BAD_ARGS, extra=['-s', 'all,run_drc'])
|
||||
|
||||
ctx.dont_expect_out_file(ctx.get_pos_both_csv_filename())
|
||||
assert ctx.search_err('Use `--skip all`')
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -95,16 +79,14 @@ def test_skip_pre_and_outputs_4(test_dir):
|
|||
prj = 'simple_2layer'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position', POS_DIR)
|
||||
ctx.run(EXIT_BAD_ARGS, extra=['-s', 'bogus'])
|
||||
|
||||
ctx.dont_expect_out_file(ctx.get_pos_both_csv_filename())
|
||||
assert ctx.search_err('Unknown preflight .?bogus')
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_skip_pre_and_outputs_5(test_dir):
|
||||
prj = 'simple_2layer'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_skip', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_skip')
|
||||
ctx.run(extra=['-s', 'run_erc,run_drc'])
|
||||
assert ctx.search_err('no need to skip')
|
||||
ctx.clean_up()
|
||||
|
|
@ -112,18 +94,16 @@ def test_skip_pre_and_outputs_5(test_dir):
|
|||
|
||||
def test_unknown_out_type(test_dir):
|
||||
prj = 'simple_2layer'
|
||||
ctx = context.TestContext(test_dir, prj, 'unknown_out', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, prj, 'unknown_out')
|
||||
ctx.run(EXIT_BAD_CONFIG)
|
||||
|
||||
ctx.dont_expect_out_file(ctx.get_pos_both_csv_filename())
|
||||
assert ctx.search_err("Unknown output type:? .?bogus")
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_unknown_out_name_1(test_dir):
|
||||
prj = 'simple_2layer'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position')
|
||||
ctx.run(EXIT_BAD_ARGS, extra=['-s', 'all', '-C', 'pp'])
|
||||
assert ctx.search_err("Unknown output .?pp")
|
||||
ctx.clean_up()
|
||||
|
|
@ -131,7 +111,7 @@ def test_unknown_out_name_1(test_dir):
|
|||
|
||||
def test_unknown_out_name_2(test_dir):
|
||||
prj = 'simple_2layer'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position')
|
||||
ctx.run(EXIT_BAD_ARGS, extra=['-s', 'all', 'pp'])
|
||||
assert ctx.search_err("Unknown output .?pp")
|
||||
ctx.clean_up()
|
||||
|
|
@ -141,72 +121,58 @@ def test_select_output(test_dir):
|
|||
prj = '3Rs'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position', POS_DIR)
|
||||
ctx.run(extra=['-s', 'all', 'pos_ascii'])
|
||||
|
||||
ctx.dont_expect_out_file(ctx.get_pos_both_csv_filename())
|
||||
ctx.expect_out_file(ctx.get_pos_both_filename())
|
||||
assert ctx.search_err('Skipping (.*)position(.*) output')
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_miss_sch(test_dir):
|
||||
prj = 'fail-project'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position')
|
||||
ctx.run(EXIT_BAD_ARGS, extra=['pos_ascii'])
|
||||
|
||||
assert ctx.search_err('No SCH file found')
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_miss_sch_2(test_dir):
|
||||
prj = 'fail-project'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position')
|
||||
ctx.run(NO_SCH_FILE, no_board_file=True, extra=['-e', 'bogus', 'pos_ascii'])
|
||||
|
||||
assert ctx.search_err('Schematic file not found')
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_miss_pcb(test_dir):
|
||||
prj = '3Rs'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position')
|
||||
ctx.board_file = 'bogus'
|
||||
ctx.run(NO_PCB_FILE, extra=['-s', 'run_erc,update_xml', 'pos_ascii'])
|
||||
|
||||
assert ctx.search_err('Board file not found')
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_miss_pcb_2(test_dir):
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position')
|
||||
ctx.run(EXIT_BAD_ARGS, no_board_file=True, extra=['-s', 'run_erc,update_xml', 'pos_ascii'])
|
||||
|
||||
assert ctx.search_err('No PCB file found')
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_miss_yaml(test_dir):
|
||||
prj = 'bom'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position')
|
||||
ctx.run(EXIT_BAD_ARGS, no_yaml_file=True)
|
||||
|
||||
assert ctx.search_err('No config file')
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_miss_yaml_2(test_dir):
|
||||
prj = '3Rs'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position')
|
||||
ctx.yaml_file = 'bogus'
|
||||
ctx.run(EXIT_BAD_ARGS)
|
||||
|
||||
assert ctx.search_err('Plot config file not found: bogus')
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -215,19 +181,15 @@ def test_auto_pcb_and_cfg_1(test_dir):
|
|||
Only one them is there. """
|
||||
prj = '3Rs'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position', POS_DIR)
|
||||
|
||||
board_file = os.path.basename(ctx.board_file)
|
||||
shutil.copy2(ctx.board_file, ctx.get_out_path(board_file))
|
||||
yaml_file = os.path.basename(ctx.yaml_file)
|
||||
shutil.copy2(ctx.yaml_file, ctx.get_out_path(yaml_file))
|
||||
|
||||
ctx.run(extra=['-s', 'all', '-i', 'pos_ascii'], no_out_dir=True, no_board_file=True, no_yaml_file=True, chdir_out=True)
|
||||
|
||||
ctx.dont_expect_out_file(ctx.get_pos_both_filename())
|
||||
ctx.expect_out_file(ctx.get_pos_both_csv_filename())
|
||||
assert ctx.search_out('Using PCB file: '+board_file)
|
||||
assert ctx.search_out('Using config file: '+yaml_file)
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -236,25 +198,20 @@ def test_auto_pcb_and_cfg_2(test_dir):
|
|||
Two of them are there. """
|
||||
prj = '3Rs'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position', POS_DIR)
|
||||
|
||||
board_file = os.path.basename(ctx.board_file)
|
||||
shutil.copy2(ctx.board_file, ctx.get_out_path(board_file))
|
||||
shutil.copy2(ctx.board_file, ctx.get_out_path('b_'+board_file))
|
||||
yaml_file = os.path.basename(ctx.yaml_file)
|
||||
shutil.copy2(ctx.yaml_file, ctx.get_out_path(yaml_file))
|
||||
shutil.copy2(ctx.yaml_file, ctx.get_out_path('b_'+yaml_file))
|
||||
|
||||
ctx.run(extra=['-s', 'all', '-i', 'pos_ascii'], no_out_dir=True, no_board_file=True, no_yaml_file=True, chdir_out=True)
|
||||
|
||||
assert ctx.search_err('More than one PCB')
|
||||
assert ctx.search_err('More than one config')
|
||||
m = ctx.search_err('Using (.*).kicad_pcb')
|
||||
assert m
|
||||
ctx.board_name = m.group(1)
|
||||
|
||||
ctx.dont_expect_out_file(ctx.get_pos_both_filename())
|
||||
ctx.expect_out_file(ctx.get_pos_both_csv_filename())
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -263,17 +220,13 @@ def test_auto_pcb_and_cfg_3(test_dir):
|
|||
Only one them is there. """
|
||||
prj = '3Rs'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position', POS_DIR)
|
||||
|
||||
sch = os.path.basename(ctx.sch_file)
|
||||
shutil.copy2(ctx.sch_file, ctx.get_out_path(sch))
|
||||
yaml_file = os.path.basename(ctx.yaml_file)
|
||||
shutil.copy2(ctx.yaml_file, ctx.get_out_path(yaml_file))
|
||||
|
||||
ctx.run(extra=['-s', 'all', '-i'], no_out_dir=True, no_board_file=True, no_yaml_file=True, chdir_out=True)
|
||||
|
||||
ctx.search_out('Using SCH file: '+sch)
|
||||
ctx.search_out('Using config file: '+yaml_file)
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -283,7 +236,6 @@ def test_auto_pcb_and_cfg_4(test_dir):
|
|||
The SCH with same name as the PCB should be selected. """
|
||||
prj = '3Rs'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position', POS_DIR)
|
||||
|
||||
sch = os.path.basename(ctx.sch_file)
|
||||
shutil.copy2(ctx.sch_file, ctx.get_out_path(sch))
|
||||
shutil.copy2(ctx.sch_file, ctx.get_out_path('b_'+sch))
|
||||
|
|
@ -291,12 +243,9 @@ def test_auto_pcb_and_cfg_4(test_dir):
|
|||
shutil.copy2(ctx.board_file, ctx.get_out_path(brd))
|
||||
yaml_file = os.path.basename(ctx.yaml_file)
|
||||
shutil.copy2(ctx.yaml_file, ctx.get_out_path(yaml_file))
|
||||
|
||||
ctx.run(extra=['-s', 'all', '-i'], no_out_dir=True, no_board_file=True, no_yaml_file=True, chdir_out=True)
|
||||
|
||||
ctx.search_err('Using ./'+sch)
|
||||
ctx.search_out('Using config file: '+yaml_file)
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
@ -304,37 +253,32 @@ def test_auto_pcb_and_cfg_5(test_dir):
|
|||
""" Test guessing the SCH and config file.
|
||||
Two SCHs. """
|
||||
prj = '3Rs'
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, prj, 'pre_and_position')
|
||||
|
||||
sch = os.path.basename(ctx.sch_file)
|
||||
shutil.copy2(ctx.sch_file, ctx.get_out_path(sch))
|
||||
shutil.copy2(ctx.sch_file, ctx.get_out_path('b_'+sch))
|
||||
yaml_file = os.path.basename(ctx.yaml_file)
|
||||
shutil.copy2(ctx.yaml_file, ctx.get_out_path(yaml_file))
|
||||
|
||||
ctx.run(extra=['-s', 'all', '-i'], no_out_dir=True, no_board_file=True, no_yaml_file=True, chdir_out=True)
|
||||
|
||||
assert ctx.search_err('Using ./(b_)?'+sch)
|
||||
assert ctx.search_out('Using config file: '+yaml_file)
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_list(test_dir):
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position')
|
||||
ctx.run(extra=['--list'], no_verbose=True, no_out_dir=True)
|
||||
|
||||
assert ctx.search_out('run_erc: True')
|
||||
assert ctx.search_out('run_drc: True')
|
||||
assert ctx.search_out('update_xml: True')
|
||||
assert ctx.search_out(r'Pick and place file.? \(position\) \[position\]')
|
||||
assert ctx.search_out(r'Pick and place file.? \(pos_ascii\) \[position\]')
|
||||
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_help(test_dir):
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position')
|
||||
ctx.run(extra=['--help'], no_verbose=True, no_out_dir=True, no_yaml_file=True)
|
||||
assert ctx.search_out('Usage:')
|
||||
assert ctx.search_out('Arguments:')
|
||||
|
|
@ -343,7 +287,7 @@ def test_help(test_dir):
|
|||
|
||||
|
||||
def test_help_list_outputs(test_dir):
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position')
|
||||
ctx.run(extra=['--help-list-outputs'], no_verbose=True, no_out_dir=True, no_yaml_file=True, no_board_file=True)
|
||||
assert ctx.search_out('Supported outputs:')
|
||||
assert ctx.search_out('Gerber format')
|
||||
|
|
@ -351,7 +295,7 @@ def test_help_list_outputs(test_dir):
|
|||
|
||||
|
||||
def test_help_output(test_dir):
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position')
|
||||
ctx.run(extra=['--help-output', 'gerber'], no_verbose=True, no_out_dir=True, no_yaml_file=True, no_board_file=True)
|
||||
assert ctx.search_out('Gerber format')
|
||||
assert ctx.search_out('Type: .?gerber.?')
|
||||
|
|
@ -359,7 +303,7 @@ def test_help_output(test_dir):
|
|||
|
||||
|
||||
def test_help_output_unk(test_dir):
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position')
|
||||
ctx.run(EXIT_BAD_ARGS, extra=['--help-output', 'bogus'], no_verbose=True, no_out_dir=True, no_yaml_file=True,
|
||||
no_board_file=True)
|
||||
assert ctx.search_err('Unknown output type')
|
||||
|
|
@ -367,14 +311,14 @@ def test_help_output_unk(test_dir):
|
|||
|
||||
|
||||
def test_help_filters(test_dir):
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position')
|
||||
ctx.run(extra=['--help-filters'], no_verbose=True, no_out_dir=True, no_yaml_file=True, no_board_file=True)
|
||||
assert ctx.search_out('Generic filter')
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_help_output_plugin_1(test_dir, monkeypatch):
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position')
|
||||
ctx.home_local_link()
|
||||
with monkeypatch.context() as m:
|
||||
m.setenv("HOME", os.path.join(ctx.get_board_dir(), '../..'))
|
||||
|
|
@ -390,7 +334,7 @@ def test_help_output_plugin_1(test_dir, monkeypatch):
|
|||
|
||||
|
||||
def test_help_output_plugin_2(test_dir, monkeypatch):
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position')
|
||||
ctx.home_local_link()
|
||||
with monkeypatch.context() as m:
|
||||
m.setenv("HOME", os.path.join(ctx.get_board_dir(), '../..'))
|
||||
|
|
@ -404,7 +348,7 @@ def test_help_output_plugin_2(test_dir, monkeypatch):
|
|||
|
||||
|
||||
def test_help_output_plugin_3(test_dir, monkeypatch):
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position')
|
||||
ctx.home_local_link()
|
||||
with monkeypatch.context() as m:
|
||||
m.setenv("HOME", os.path.join(ctx.get_board_dir(), '../..'))
|
||||
|
|
@ -415,7 +359,7 @@ def test_help_output_plugin_3(test_dir, monkeypatch):
|
|||
|
||||
|
||||
def test_help_output_plugin_4(test_dir, monkeypatch):
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position')
|
||||
ctx.home_local_link()
|
||||
with monkeypatch.context() as m:
|
||||
m.setenv("HOME", os.path.join(ctx.get_board_dir(), '../..'))
|
||||
|
|
@ -426,7 +370,7 @@ def test_help_output_plugin_4(test_dir, monkeypatch):
|
|||
|
||||
|
||||
def test_help_outputs(test_dir):
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position')
|
||||
ctx.run(extra=['--help-outputs'], no_verbose=True, no_out_dir=True, no_yaml_file=True, no_board_file=True)
|
||||
assert ctx.search_out('Gerber format')
|
||||
assert ctx.search_out('Type: .?gerber.?')
|
||||
|
|
@ -434,7 +378,7 @@ def test_help_outputs(test_dir):
|
|||
|
||||
|
||||
def test_help_preflights(test_dir):
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position', POS_DIR)
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position')
|
||||
ctx.run(extra=['--help-preflights'], no_verbose=True, no_out_dir=True, no_yaml_file=True, no_board_file=True)
|
||||
assert ctx.search_out('Supported preflight options')
|
||||
ctx.clean_up()
|
||||
|
|
@ -442,7 +386,7 @@ def test_help_preflights(test_dir):
|
|||
|
||||
def test_example_1(test_dir):
|
||||
""" Example without board """
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position', '')
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position')
|
||||
ctx.run(extra=['--example'], no_verbose=True, no_yaml_file=True, no_board_file=True)
|
||||
assert ctx.expect_out_file(EXAMPLE_CFG)
|
||||
ctx.clean_up()
|
||||
|
|
@ -450,7 +394,7 @@ def test_example_1(test_dir):
|
|||
|
||||
def test_example_2(test_dir):
|
||||
""" Example with board """
|
||||
ctx = context.TestContext(test_dir, 'good-project', 'pre_and_position', '')
|
||||
ctx = context.TestContext(test_dir, 'good-project', 'pre_and_position')
|
||||
ctx.run(extra=['--example'], no_verbose=True, no_yaml_file=True)
|
||||
assert ctx.expect_out_file(EXAMPLE_CFG)
|
||||
ctx.search_in_file(EXAMPLE_CFG, ['layers: all'])
|
||||
|
|
@ -459,7 +403,7 @@ def test_example_2(test_dir):
|
|||
|
||||
def test_example_3(test_dir):
|
||||
""" Overwrite error """
|
||||
ctx = context.TestContext(test_dir, 'good-project', 'pre_and_position', '')
|
||||
ctx = context.TestContext(test_dir, 'good-project', 'pre_and_position')
|
||||
ctx.run(extra=['--example'], no_verbose=True, no_yaml_file=True)
|
||||
assert ctx.expect_out_file(EXAMPLE_CFG)
|
||||
ctx.run(WONT_OVERWRITE, extra=['--example'], no_verbose=True, no_yaml_file=True)
|
||||
|
|
@ -468,7 +412,7 @@ def test_example_3(test_dir):
|
|||
|
||||
def test_example_4(test_dir):
|
||||
""" Expand copied layers """
|
||||
ctx = context.TestContext(test_dir, 'good-project', 'pre_and_position', '')
|
||||
ctx = context.TestContext(test_dir, 'good-project', 'pre_and_position')
|
||||
ctx.run(extra=['--example', '-P'], no_verbose=True, no_yaml_file=True)
|
||||
assert ctx.expect_out_file(EXAMPLE_CFG)
|
||||
ctx.search_in_file(EXAMPLE_CFG, ['GND.Cu', 'pen_width: 35.0'])
|
||||
|
|
@ -478,7 +422,7 @@ def test_example_4(test_dir):
|
|||
|
||||
def test_example_5(test_dir):
|
||||
""" Copy setting from PCB """
|
||||
ctx = context.TestContext(test_dir, 'good-project', 'pre_and_position', '')
|
||||
ctx = context.TestContext(test_dir, 'good-project', 'pre_and_position')
|
||||
output_dir = os.path.join(ctx.output_dir, 'pp')
|
||||
ctx.run(extra=['--example', '-p', '-d', output_dir], no_verbose=True, no_yaml_file=True, no_out_dir=True)
|
||||
file = os.path.join('pp', EXAMPLE_CFG)
|
||||
|
|
@ -489,7 +433,7 @@ def test_example_5(test_dir):
|
|||
|
||||
def test_example_6(test_dir):
|
||||
""" Copy setting but no PCB """
|
||||
ctx = context.TestContext(test_dir, 'good-project', 'pre_and_position', '')
|
||||
ctx = context.TestContext(test_dir, 'good-project', 'pre_and_position')
|
||||
ctx.run(EXIT_BAD_ARGS, extra=['--example', '-p'], no_verbose=True, no_yaml_file=True, no_board_file=True)
|
||||
assert ctx.search_err('no PCB specified')
|
||||
ctx.clean_up()
|
||||
|
|
@ -497,7 +441,7 @@ def test_example_6(test_dir):
|
|||
|
||||
def test_example_7(test_dir, monkeypatch):
|
||||
""" With dummy plug-ins """
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position', '')
|
||||
ctx = context.TestContext(test_dir, '3Rs', 'pre_and_position')
|
||||
ctx.home_local_link()
|
||||
with monkeypatch.context() as m:
|
||||
m.setenv("HOME", os.path.join(ctx.get_board_dir(), '../..'))
|
||||
|
|
@ -509,7 +453,7 @@ def test_example_7(test_dir, monkeypatch):
|
|||
|
||||
def test_corrupted_pcb(test_dir):
|
||||
prj = 'bom_no_xml'
|
||||
ctx = context.TestContext(test_dir, prj, 'print_pcb', '')
|
||||
ctx = context.TestContext(test_dir, prj, 'print_pcb')
|
||||
ctx.run(CORRUPTED_PCB)
|
||||
assert ctx.search_err('Error loading PCB file')
|
||||
ctx.clean_up()
|
||||
|
|
@ -517,7 +461,7 @@ def test_corrupted_pcb(test_dir):
|
|||
|
||||
def test_pcbdraw_fail(test_dir):
|
||||
prj = 'bom'
|
||||
ctx = context.TestContext(test_dir, prj, 'pcbdraw_fail', '')
|
||||
ctx = context.TestContext(test_dir, prj, 'pcbdraw_fail')
|
||||
ctx.run(PCBDRAW_ERR)
|
||||
assert ctx.search_err('Failed to run')
|
||||
ctx.clean_up()
|
||||
|
|
@ -576,7 +520,7 @@ def test_wrong_global_redef(test_dir):
|
|||
|
||||
|
||||
def test_no_pcbnew(test_dir):
|
||||
ctx = context.TestContext(test_dir, 'bom', 'bom', '')
|
||||
ctx = context.TestContext(test_dir, 'bom', 'bom')
|
||||
cmd = [os.path.abspath(os.path.dirname(os.path.abspath(__file__))+'/force_pcbnew_error.py')]
|
||||
ctx.do_run(cmd, NO_PCBNEW_MODULE)
|
||||
ctx.search_err('Failed to import pcbnew Python module.')
|
||||
|
|
@ -584,21 +528,21 @@ def test_no_pcbnew(test_dir):
|
|||
|
||||
|
||||
def test_old_pcbnew(test_dir):
|
||||
ctx = context.TestContext(test_dir, 'bom', 'bom', '')
|
||||
ctx = context.TestContext(test_dir, 'bom', 'bom')
|
||||
cmd = [os.path.abspath(os.path.dirname(os.path.abspath(__file__))+'/force_pcbnew_error.py'), 'fake']
|
||||
ctx.do_run(cmd)
|
||||
ctx.search_err('Unknown KiCad version, please install KiCad 5.1.6 or newer')
|
||||
|
||||
|
||||
def test_no_yaml(test_dir):
|
||||
ctx = context.TestContext(test_dir, 'bom', 'bom', '')
|
||||
ctx = context.TestContext(test_dir, 'bom', 'bom')
|
||||
cmd = [os.path.abspath(os.path.dirname(os.path.abspath(__file__))+'/force_yaml_error.py')]
|
||||
ctx.do_run(cmd, NO_YAML_MODULE)
|
||||
ctx.search_err('No yaml module for Python, install python3-yaml')
|
||||
|
||||
|
||||
def test_no_colorama(test_dir):
|
||||
ctx = context.TestContext(test_dir, 'bom', 'bom', '')
|
||||
ctx = context.TestContext(test_dir, 'bom', 'bom')
|
||||
cmd = [os.path.abspath(os.path.dirname(os.path.abspath(__file__))+'/force_colorama_error.py')]
|
||||
ctx.do_run(cmd, use_a_tty=True)
|
||||
ctx.search_err(r'\[31m.\[1mERROR:Testing 1 2 3')
|
||||
|
|
@ -800,7 +744,7 @@ def check_makefile(ctx, mkfile, prj, dbg, txt):
|
|||
|
||||
def test_makefile_1(test_dir):
|
||||
prj = 'test_v5'
|
||||
ctx = context.TestContext(test_dir, prj, 'makefile_1', '')
|
||||
ctx = context.TestContext(test_dir, prj, 'makefile_1')
|
||||
mkfile = ctx.get_out_path('Makefile')
|
||||
ctx.run(extra=['-s', 'all', 'archive'])
|
||||
ctx.run(extra=['-m', mkfile])
|
||||
|
|
@ -810,7 +754,7 @@ def test_makefile_1(test_dir):
|
|||
|
||||
def test_makefile_2(test_dir):
|
||||
prj = 'test_v5'
|
||||
ctx = context.TestContext(test_dir, prj, 'makefile_1', '')
|
||||
ctx = context.TestContext(test_dir, prj, 'makefile_1')
|
||||
mkfile = ctx.get_out_path('Makefile')
|
||||
ctx.run(extra=['-s', 'all', 'archive'])
|
||||
ctx.run(extra=['-m', mkfile], no_verbose=True)
|
||||
|
|
@ -820,7 +764,7 @@ def test_makefile_2(test_dir):
|
|||
|
||||
def test_empty_zip(test_dir):
|
||||
prj = 'test_v5'
|
||||
ctx = context.TestContext(test_dir, prj, 'empty_zip', '')
|
||||
ctx = context.TestContext(test_dir, prj, 'empty_zip')
|
||||
ctx.run()
|
||||
ctx.expect_out_file(prj+'-result.zip')
|
||||
ctx.search_err('No files provided, creating an empty archive')
|
||||
|
|
@ -840,7 +784,7 @@ def test_compress_fail_deps(test_dir, monkeypatch):
|
|||
def test_import_1(test_dir):
|
||||
""" Import some outputs """
|
||||
prj = 'test_v5'
|
||||
ctx = context.TestContext(test_dir, prj, 'import_test_1', '')
|
||||
ctx = context.TestContext(test_dir, prj, 'import_test_1')
|
||||
ctx.run(extra=['-i'])
|
||||
ctx.search_err(r'Outputs loaded from `tests/yaml_samples/gerber_inner.kibot.yaml`: \[\'gerbers\', \'result\'\]')
|
||||
ctx.search_err(r'Outputs loaded from `tests/yaml_samples/ibom.kibot.yaml`: \[\'interactive_bom\'\]')
|
||||
|
|
@ -850,7 +794,7 @@ def test_import_1(test_dir):
|
|||
def test_import_2(test_dir):
|
||||
""" Import a global option """
|
||||
prj = 'test_v5'
|
||||
ctx = context.TestContext(test_dir, prj, 'import_test_2', '')
|
||||
ctx = context.TestContext(test_dir, prj, 'import_test_2')
|
||||
ctx.run()
|
||||
ctx.expect_out_file(POS_DIR+'/test_v5_(bottom_pos).pos')
|
||||
ctx.expect_out_file(POS_DIR+'/test_v5_(top_pos).pos')
|
||||
|
|
@ -860,7 +804,7 @@ def test_import_2(test_dir):
|
|||
def test_import_3(test_dir):
|
||||
""" Import an output and change it """
|
||||
prj = 'test_v5'
|
||||
ctx = context.TestContext(test_dir, prj, 'import_test_3', '')
|
||||
ctx = context.TestContext(test_dir, prj, 'import_test_3')
|
||||
ctx.run(extra=['position_mine'])
|
||||
ctx.expect_out_file(POS_DIR+'/test_v5_(both_pos).csv')
|
||||
ctx.clean_up()
|
||||
|
|
@ -869,7 +813,7 @@ def test_import_3(test_dir):
|
|||
def test_import_4(test_dir):
|
||||
""" Import an output and change it, also disable the original """
|
||||
prj = 'test_v5'
|
||||
ctx = context.TestContext(test_dir, prj, 'import_test_4', '')
|
||||
ctx = context.TestContext(test_dir, prj, 'import_test_4')
|
||||
ctx.run(extra=[])
|
||||
ctx.expect_out_file(POS_DIR+'/test_v5_(both_pos).csv')
|
||||
ctx.dont_expect_out_file(POS_DIR+'/test_v5_(bottom_pos).csv')
|
||||
|
|
@ -879,7 +823,7 @@ def test_import_4(test_dir):
|
|||
def test_disable_default_1(test_dir):
|
||||
""" Disable in the same file and out-of-order """
|
||||
prj = 'test_v5'
|
||||
ctx = context.TestContext(test_dir, prj, 'disable_default_1', '')
|
||||
ctx = context.TestContext(test_dir, prj, 'disable_default_1')
|
||||
ctx.run(extra=[])
|
||||
ctx.expect_out_file(POS_DIR+'/test_v5_(both_pos_test).csv')
|
||||
ctx.dont_expect_out_file(POS_DIR+'/test_v5_(bottom_pos).csv')
|
||||
|
|
@ -889,7 +833,7 @@ def test_disable_default_1(test_dir):
|
|||
def test_expand_comment_1(test_dir):
|
||||
""" Disable in the same file and out-of-order """
|
||||
prj = 'test_v5'
|
||||
ctx = context.TestContext(test_dir, prj, 'expand_comment_1', '')
|
||||
ctx = context.TestContext(test_dir, prj, 'expand_comment_1')
|
||||
ctx.run(extra=[])
|
||||
ctx.expect_out_file(POS_DIR+'/test_v5_(Comment 1)_(The_C2).csv')
|
||||
ctx.clean_up()
|
||||
|
|
@ -898,7 +842,7 @@ def test_expand_comment_1(test_dir):
|
|||
def test_compress_sources_1(test_dir):
|
||||
""" Disable in the same file and out-of-order """
|
||||
prj = 'test_v5'
|
||||
ctx = context.TestContext(test_dir, prj, 'compress_sources_1', '')
|
||||
ctx = context.TestContext(test_dir, prj, 'compress_sources_1')
|
||||
ctx.run()
|
||||
files = ['source/'+prj+'.kicad_pcb', 'source/'+prj+'.sch', 'source/deeper.sch', 'source/sub-sheet.sch']
|
||||
ctx.test_compress(prj + '-result.tar.bz2', files)
|
||||
|
|
@ -908,7 +852,7 @@ def test_compress_sources_1(test_dir):
|
|||
def test_date_format_1(test_dir):
|
||||
""" Date from SCH reformated """
|
||||
prj = 'test_v5'
|
||||
ctx = context.TestContext(test_dir, prj, 'date_format_1', '')
|
||||
ctx = context.TestContext(test_dir, prj, 'date_format_1')
|
||||
ctx.run(extra=[])
|
||||
ctx.expect_out_file(POS_DIR+'/test_v5_20200812.csv')
|
||||
ctx.clean_up()
|
||||
|
|
@ -917,7 +861,7 @@ def test_date_format_1(test_dir):
|
|||
def test_date_format_2(test_dir):
|
||||
""" Date from SCH reformated """
|
||||
prj = 'bom'
|
||||
ctx = context.TestContext(test_dir, prj, 'date_format_1', '')
|
||||
ctx = context.TestContext(test_dir, prj, 'date_format_1')
|
||||
ctx.run(extra=[])
|
||||
ctx.expect_out_file(POS_DIR+'/bom_13_07_2020.csv')
|
||||
assert ctx.search_err('Trying to reformat SCH time, but not in ISO format')
|
||||
|
|
@ -926,7 +870,7 @@ def test_date_format_2(test_dir):
|
|||
|
||||
def test_download_datasheets_1(test_dir):
|
||||
prj = 'kibom-variant_2ds'
|
||||
ctx = context.TestContextSCH(test_dir, prj, 'download_datasheets_1', '')
|
||||
ctx = context.TestContextSCH(test_dir, prj, 'download_datasheets_1')
|
||||
# We use a fake server to avoid needing good URLs and reliable internet connection
|
||||
ctx.run(kicost=True)
|
||||
ctx.expect_out_file('DS/C0805C102J4GAC7800.pdf')
|
||||
|
|
@ -1151,7 +1095,7 @@ def test_annotate_pcb_tbrl_small_grid(test_dir):
|
|||
|
||||
def test_gencad_1(test_dir):
|
||||
prj = 'gencad'
|
||||
ctx = context.TestContext(test_dir, prj, 'gencad_1', '')
|
||||
ctx = context.TestContext(test_dir, prj, 'gencad_1')
|
||||
ctx.run()
|
||||
o = prj+'-gencad.cad'
|
||||
ctx.expect_out_file(o)
|
||||
|
|
@ -1216,7 +1160,7 @@ def test_netlist_ipc_1(test_dir):
|
|||
|
||||
def test_dependencies_1(test_dir):
|
||||
dep = 'KiCad Automation tools'
|
||||
ctx = context.TestContext(test_dir, 'bom', 'netlist_ipc_1', '')
|
||||
ctx = context.TestContext(test_dir, 'bom', 'netlist_ipc_1')
|
||||
ctx.run(extra=['--help-dependencies'], no_board_file=True, no_out_dir=True, no_yaml_file=True)
|
||||
ctx.search_out(dep)
|
||||
ctx.run(extra=['--help-dependencies', '--markdown'], no_board_file=True, no_out_dir=True, no_yaml_file=True)
|
||||
|
|
|
|||
|
|
@ -1,19 +1,10 @@
|
|||
import os
|
||||
import sys
|
||||
import re
|
||||
import pytest
|
||||
import coverage
|
||||
import logging
|
||||
import subprocess
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
prev_dir = os.path.dirname(prev_dir)
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
from . import context
|
||||
from kibot.layer import Layer
|
||||
from kibot.pre_base import BasePreFlight
|
||||
from kibot.out_base import BaseOutput
|
||||
|
|
|
|||
|
|
@ -6,19 +6,9 @@ pytest-3 --log-cli-level debug
|
|||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import coverage
|
||||
from shutil import which
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
# One more level for the project
|
||||
prev_dir = os.path.dirname(prev_dir)
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
from . import context
|
||||
from kibot.mcpyrate import activate # noqa: F401
|
||||
from kibot.out_pcbdraw import PcbDrawOptions
|
||||
|
||||
|
|
|
|||
|
|
@ -4,17 +4,8 @@ Tests of PDF format (PCB Plot).
|
|||
For debug information use:
|
||||
pytest-3 --log-cli-level debug
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
|
||||
|
||||
from . import context
|
||||
PS_DIR = 'PDF'
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,16 +17,9 @@ For debug information use:
|
|||
pytest-3 --log-cli-level debug
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
from . import context
|
||||
|
||||
POS_DIR = 'positiondir'
|
||||
positions = {'R1': (105, 35, 'top', 90),
|
||||
|
|
|
|||
|
|
@ -13,20 +13,13 @@ For debug information use:
|
|||
pytest-3 --log-cli-level debug
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
import re
|
||||
import json
|
||||
from subprocess import run, PIPE
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
from kibot.misc import (DRC_ERROR, ERC_ERROR, BOM_ERROR, CORRUPTED_PCB, CORRUPTED_SCH, EXIT_BAD_CONFIG)
|
||||
from . import context
|
||||
from kibot.misc import DRC_ERROR, ERC_ERROR, BOM_ERROR, CORRUPTED_PCB, CORRUPTED_SCH, EXIT_BAD_CONFIG
|
||||
|
||||
|
||||
def test_erc_1(test_dir):
|
||||
|
|
|
|||
|
|
@ -10,13 +10,7 @@ pytest-3 --log-cli-level debug
|
|||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
from . import context
|
||||
|
||||
PDF_DIR = 'Layers'
|
||||
PDF_FILE = 'bom-F_Cu+F_SilkS.pdf'
|
||||
|
|
|
|||
|
|
@ -10,19 +10,13 @@ pytest-3 --log-cli-level debug
|
|||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
import coverage
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
from . import context
|
||||
from kibot.misc import (PDF_SCH_PRINT, SVG_SCH_PRINT)
|
||||
from kibot.kicad.v5_sch import Schematic, SchFileError, DrawPoligon, Pin
|
||||
from kibot.kicad.v6_sch import SchematicV6
|
||||
from kibot.globals import Globals
|
||||
# Utils import
|
||||
from utils import context
|
||||
|
||||
PDF_DIR = ''
|
||||
PDF_FILE = 'Schematic.pdf'
|
||||
|
|
|
|||
|
|
@ -4,17 +4,7 @@ Tests of Postscript format.
|
|||
For debug information use:
|
||||
pytest-3 --log-cli-level debug
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
|
||||
|
||||
from . import context
|
||||
PS_DIR = 'PS'
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,18 +5,7 @@ Tests SCH errors
|
|||
For debug information use:
|
||||
pytest-3 --log-cli-level debug
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
prev_dir = os.path.dirname(prev_dir)
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
from . import context
|
||||
from kibot.misc import CORRUPTED_SCH
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,13 +6,9 @@ pytest-3 --log-cli-level debug
|
|||
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import pytest
|
||||
import coverage
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
from . import context # noqa: F401
|
||||
from kibot.misc import (MISSING_TOOL, CMD_EESCHEMA_DO)
|
||||
from kibot.kiplot import (check_script, check_version)
|
||||
import kibot.kiplot
|
||||
|
|
|
|||
|
|
@ -8,16 +8,10 @@ For debug information use:
|
|||
pytest-3 --log-cli-level debug
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from glob import glob
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
from . import context
|
||||
|
||||
|
||||
STEP_DIR = '3D'
|
||||
# STEP_FILE = 'bom.step'
|
||||
|
|
|
|||
|
|
@ -4,17 +4,7 @@ Tests of SVG format.
|
|||
For debug information use:
|
||||
pytest-3 --log-cli-level debug
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
|
||||
|
||||
from . import context
|
||||
PS_DIR = 'SVG'
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -49,19 +49,8 @@ pytest-3 --log-cli-level debug
|
|||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
# Look for the 'utils' module from where the script is running
|
||||
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
# Utils import
|
||||
from utils import context
|
||||
prev_dir = os.path.dirname(prev_dir)
|
||||
if prev_dir not in sys.path:
|
||||
sys.path.insert(0, prev_dir)
|
||||
from . import context
|
||||
from kibot.misc import (EXIT_BAD_CONFIG, PLOT_ERROR, BOM_ERROR, WRONG_ARGUMENTS)
|
||||
|
||||
|
||||
PRJ = 'fail-project'
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue