Tests adapted to the new error message strings.

This commit is contained in:
Salvador E. Tropea 2020-06-19 16:00:16 -03:00
parent 7679604646
commit 6ed99d8515
3 changed files with 23 additions and 22 deletions

View File

@ -0,0 +1 @@
dummy

View File

@ -56,9 +56,9 @@ def test_skip_pre_and_outputs_2():
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 .?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()
@ -81,7 +81,7 @@ def test_skip_pre_and_outputs_4():
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')
assert ctx.search_err('Unknown preflight .?bogus')
ctx.clean_up()
@ -92,7 +92,7 @@ def test_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'")
assert ctx.search_err("Unknown output type:? .?bogus")
ctx.clean_up()
@ -104,13 +104,13 @@ def test_select_output():
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')
assert ctx.search_err('Skipping (.*)position(.*) output')
ctx.clean_up()
def test_miss_sch():
prj = '3Rs'
prj = 'fail-project'
ctx = context.TestContext('MissingSCH', prj, 'pre_and_position', POS_DIR)
ctx.run(NO_SCH_FILE, extra=['pos_ascii'])
@ -211,7 +211,7 @@ def test_list():
assert ctx.search_err('run_erc: True')
assert ctx.search_err('run_drc: True')
assert ctx.search_err('update_xml: True')
assert ctx.search_err(r'position \(Pick and place file\) \[position\]')
assert ctx.search_err(r'pos_ascii \(Pick and place file\) \[position\]')
assert ctx.search_err(r'Pick and place file.? \(position\) \[position\]')
assert ctx.search_err(r'Pick and place file.? \(pos_ascii\) \[position\]')
ctx.clean_up()

View File

@ -14,7 +14,6 @@ Tests various errors in the config file
- No output:
- name
- type
- options
- layers
For debug information use:
@ -35,7 +34,7 @@ from kiplot.misc import (EXIT_BAD_CONFIG, PLOT_ERROR)
def test_no_version():
ctx = context.TestContext('ErrorNoVersion', '3Rs', 'error_no_version', None)
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err('YAML config needs kiplot.version')
assert ctx.search_err('YAML config needs `kiplot.version`.')
ctx.clean_up()
@ -49,14 +48,14 @@ def test_wrong_version():
def test_drill_map_no_type():
ctx = context.TestContext('ErrorDrillMapNoType', '3Rs', 'error_drill_map_no_type', None)
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Missing `type' in drill map section")
assert ctx.search_err("Empty drill `map` section")
ctx.clean_up()
def test_drill_map_wrong_type():
ctx = context.TestContext('ErrorDrillMapWrongType', '3Rs', 'error_drill_map_wrong_type', None)
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown drill map type: bogus")
assert ctx.search_err("Unknown drill `map` `type`: bogus")
ctx.clean_up()
@ -70,7 +69,7 @@ def test_wrong_layer_1():
def test_wrong_layer_2():
ctx = context.TestContext('ErrorWrongLayer2', '3Rs', 'error_wrong_layer_2', None)
ctx.run(PLOT_ERROR)
assert ctx.search_err("Inner layer 1 is not valid for this board")
assert ctx.search_err("Inner layer (.*) is not valid for this board")
ctx.clean_up()
@ -91,21 +90,22 @@ def test_no_name():
def test_no_type():
ctx = context.TestContext('ErrorNoType', '3Rs', 'error_no_type', None)
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Output 'PDF' needs a type")
assert ctx.search_err("Output .PDF. needs a type")
ctx.clean_up()
def test_no_options():
ctx = context.TestContext('ErrorNoOptions', '3Rs', 'error_no_options', None)
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Output 'PDF' needs options")
ctx.clean_up()
# Now is valid
# def test_no_options():
# ctx = context.TestContext('ErrorNoOptions', '3Rs', 'error_no_options', None)
# ctx.run(EXIT_BAD_CONFIG)
# assert ctx.search_err("Output .PDF. needs options")
# ctx.clean_up()
def test_no_layers():
ctx = context.TestContext('ErrorNoLayers', '3Rs', 'error_no_layers', None)
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("You must specify the layers for `PDF`")
assert ctx.search_err("Missing `layers` list")
ctx.clean_up()
@ -119,5 +119,5 @@ def test_error_step_origin():
def test_error_step_min_distance():
ctx = context.TestContext('ErrorStepMinDistance', 'bom', 'error_step_min_distance', None)
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("min_distance must be a number")
assert ctx.search_err("`min_distance` must be a number")
ctx.clean_up()