Added tests for various cases of --skip command line option.

This commit is contained in:
Salvador E. Tropea 2020-05-25 19:49:05 -03:00
parent 1dda835cc5
commit 5a23fe2b37
2 changed files with 93 additions and 0 deletions

View File

@ -0,0 +1,72 @@
"""
Tests miscellaneous stuff.
- -s all -i
- -s run_erc,update_xml,run_drc -i
- -s all,run_drc
- -s bogus
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.abspath(__file__))
sys.path.insert(0, os.path.dirname(prev_dir))
# Utils import
from utils import context
sys.path.insert(0, os.path.dirname(prev_dir))
from kiplot.misc import (EXIT_BAD_ARGS)
POS_DIR = 'positiondir'
def test_skip_pre_and_outputs():
prj = 'simple_2layer'
ctx = context.TestContext('SkipPreAndPos', 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 pre-flight actions')
assert ctx.search_err('Skipping all outputs')
ctx.clean_up()
def test_skip_pre_and_outputs_2():
prj = 'simple_2layer'
ctx = context.TestContext('SkipPreAndPos2', 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()
def test_skip_pre_and_outputs_3():
prj = 'simple_2layer'
ctx = context.TestContext('SkipPreAndPos3', 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()
def test_skip_pre_and_outputs_4():
prj = 'simple_2layer'
ctx = context.TestContext('SkipPreAndPos4', 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 action to skip: bogus')
ctx.clean_up()

View File

@ -0,0 +1,21 @@
# Example KiPlot config file
kiplot:
version: 1
preflight:
run_erc: true
update_xml: true
run_drc: true
check_zone_fills: true
ignore_unconnected: false
outputs:
- name: 'position'
comment: "Pick and place file"
type: position
dir: positiondir
options:
format: CSV # CSV or ASCII format
units: millimeters # millimeters or inches
separate_files_for_front_and_back: false
only_smd: true