Added tests to cover out_pdf_pcb_print.py, error case left out

This commit is contained in:
Salvador E. Tropea 2020-07-09 09:20:52 -03:00
parent 2ade49bde5
commit a48e9ecc96
5 changed files with 23 additions and 4 deletions

View File

@ -40,7 +40,9 @@ class PDF_Pcb_PrintOptions(BaseOptions):
# Execute it
logger.debug('Executing: '+str(cmd))
ret = call(cmd)
if ret:
if ret: # pragma: no cover
# We check all the arguments, we even load the PCB
# A fail here isn't easy to reproduce
logger.error(CMD_PCBNEW_PRINT_LAYERS+' returned %d', ret)
exit(PDF_PCB_PRINT)

View File

@ -19,7 +19,7 @@ if prev_dir not in sys.path:
from utils import context
PDF_DIR = 'Layers'
PDF_FILE = 'PCB_Top.pdf'
PDF_FILE = 'bom.pdf'
PDF_FILE_B = 'PCB_Bot.pdf'

View File

@ -421,3 +421,11 @@ def test_error_wrong_drill_marks():
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown drill mark type: bogus")
ctx.clean_up()
def test_error_print_pcb_no_layer():
prj = 'bom'
ctx = context.TestContext('PrPCB', prj, 'error_print_pcb_no_layer', '')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Missing .?layers.? list")
ctx.clean_up()

View File

@ -0,0 +1,11 @@
# Example KiPlot config file
kiplot:
version: 1
outputs:
- name: 'print_front'
comment: "Print F.Cu+F.SilkS"
type: pdf_pcb_print
dir: Layers
options:
output_name: PCB_Top.pdf

View File

@ -7,8 +7,6 @@ outputs:
comment: "Print F.Cu+F.SilkS"
type: pdf_pcb_print
dir: Layers
options:
output_name: PCB_Top.pdf
layers:
- layer: F.Cu
- layer: F.SilkS