diff --git a/tests/test_plot/test_misc.py b/tests/test_plot/test_misc.py index 8137b142..a4e44737 100644 --- a/tests/test_plot/test_misc.py +++ b/tests/test_plot/test_misc.py @@ -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() diff --git a/tests/test_plot/test_yaml_errors.py b/tests/test_plot/test_yaml_errors.py index a3f2fb78..f3dd704c 100644 --- a/tests/test_plot/test_yaml_errors.py +++ b/tests/test_plot/test_yaml_errors.py @@ -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() diff --git a/tests/yaml_samples/error_makefile_wrong_out.kibot.yaml b/tests/yaml_samples/error_makefile_wrong_out.kibot.yaml new file mode 100644 index 00000000..eb051ea4 --- /dev/null +++ b/tests/yaml_samples/error_makefile_wrong_out.kibot.yaml @@ -0,0 +1,10 @@ +kibot: + version: 1 + +outputs: + - name: 'archive' + type: compress + options: + files: + - from_output: 'position' + diff --git a/tests/yaml_samples/makefile_1.kibot.yaml b/tests/yaml_samples/makefile_1.kibot.yaml index aaeb0987..b27e12cf 100644 --- a/tests/yaml_samples/makefile_1.kibot.yaml +++ b/tests/yaml_samples/makefile_1.kibot.yaml @@ -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 +