Added more test for compress output.

This commit is contained in:
Salvador E. Tropea 2021-01-29 08:46:23 -03:00
parent 89eedf1d3b
commit f29c0c5361
4 changed files with 43 additions and 4 deletions

View File

@ -52,7 +52,7 @@ from kibot.gs import GS
POS_DIR = 'positiondir'
MK_TARGETS = ['position']
MK_TARGETS = ['position', 'archive']
cov = coverage.Coverage()
@ -555,6 +555,7 @@ def test_makefile_1():
prj = 'test_v5'
ctx = context.TestContext('test_makefile_1', prj, 'makefile_1', '')
mkfile = ctx.get_out_path('Makefile')
ctx.run()
ctx.run(extra=['-m', mkfile])
ctx.expect_out_file('Makefile')
targets = ctx.read_mk_targets(mkfile)
@ -568,10 +569,22 @@ def test_makefile_1():
# position target
deps = targets['position'].split(' ')
assert len(deps) == 2, deps
assert ctx.get_out_path(os.path.join(POS_DIR, prj+'-top_pos.csv'))
assert ctx.get_out_path(os.path.join(POS_DIR, prj+'-bottom_pos.csv'))
assert ctx.get_out_path(os.path.join(POS_DIR, prj+'-top_pos.csv')) in deps
assert ctx.get_out_path(os.path.join(POS_DIR, prj+'-bottom_pos.csv')) in deps
assert os.path.abspath(targets[targets['position']]) == ctx.board_file
logging.debug('- Target `position` OK')
# archive target
deps = targets['archive'].split(' ')
assert len(deps) == 1, deps
assert ctx.get_out_path(prj+'-archive.zip') in deps
deps = targets[targets['archive']].split(' ')
assert len(deps) == 5, deps
assert 'position' in deps
assert ctx.get_out_path('error.txt') in deps
assert ctx.get_out_path('output.txt') in deps
assert ctx.get_out_path('Makefile') in deps
assert ctx.get_out_path('positiondir') in deps
logging.debug('- Target `archive` OK')
ctx.clean_up()

View File

@ -59,7 +59,7 @@ 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 (EXIT_BAD_CONFIG, PLOT_ERROR, BOM_ERROR)
from kibot.misc import (EXIT_BAD_CONFIG, PLOT_ERROR, BOM_ERROR, WRONG_ARGUMENTS)
PRJ = 'fail-project'
@ -619,3 +619,10 @@ def test_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():
ctx = context.TestContext('test_error_makefile_wrong_out', 'bom', 'error_makefile_wrong_out', '')
ctx.run(WRONG_ARGUMENTS)
assert ctx.search_err("Unknown output `position` selected in")
ctx.clean_up()

View File

@ -0,0 +1,10 @@
kibot:
version: 1
outputs:
- name: 'archive'
type: compress
options:
files:
- from_output: 'position'

View File

@ -10,3 +10,12 @@ outputs:
units: millimeters # millimeters or inches
separate_files_for_front_and_back: true
only_smd: true
- name: 'archive'
type: compress
options:
files:
- from_output: 'position'
- source: '*'
dest: AnotherCopy