Added import tests.
This commit is contained in:
parent
38420ba173
commit
a49d4e45fa
|
|
@ -192,7 +192,7 @@ class CfgYamlReader(object):
|
|||
outputs.extend(outs)
|
||||
logger.debug('Outputs loaded from `{}`: {}'.format(os.path.relpath(fn), list(map(lambda c: c.name, outs))))
|
||||
else:
|
||||
logger.warning(W_NOOUTPUTS+" No outputs found in `{}`".format(fn))
|
||||
logger.warning(W_NOOUTPUTS+"No outputs found in `{}`".format(fn))
|
||||
return outputs
|
||||
|
||||
def load_yaml(self, fstream):
|
||||
|
|
|
|||
|
|
@ -785,3 +785,12 @@ def test_compress_fail_deps(test_dir, monkeypatch):
|
|||
ctx.run(INTERNAL_ERROR)
|
||||
ctx.search_err(r"Unable to generate `dummy` from 'Test plug-in, dummy' \(do_test\) \[test\]")
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_import_1(test_dir):
|
||||
prj = 'test_v5'
|
||||
ctx = context.TestContext(test_dir, 'test_import_1', prj, 'import_test_1', '')
|
||||
ctx.run(extra=['-i'])
|
||||
ctx.search_err(r'Outputs loaded from `tests/yaml_samples/gerber_inner.kibot.yaml`: \[\'gerbers\', \'result\'\]')
|
||||
ctx.search_err(r'Outputs loaded from `tests/yaml_samples/ibom.kibot.yaml`: \[\'interactive_bom\'\]')
|
||||
ctx.clean_up()
|
||||
|
|
|
|||
|
|
@ -668,3 +668,31 @@ def test_error_aggregate_miss_file(test_dir):
|
|||
ctx.run(EXIT_BAD_CONFIG)
|
||||
assert ctx.search_err("Missing `dummy`")
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_error_wrong_import_type(test_dir):
|
||||
ctx = context.TestContext(test_dir, 'test_error_wrong_import_type', PRJ, 'error_wrong_import_type', '')
|
||||
ctx.run(EXIT_BAD_CONFIG)
|
||||
assert ctx.search_err(r"Incorrect `import` section \(must be a list\)")
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_error_import_not_str(test_dir):
|
||||
ctx = context.TestContext(test_dir, 'test_error_import_not_str', PRJ, 'error_import_not_str', '')
|
||||
ctx.run(EXIT_BAD_CONFIG)
|
||||
assert ctx.search_err(r"`import` items must be strings")
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_error_import_miss_file(test_dir):
|
||||
ctx = context.TestContext(test_dir, 'test_error_import_miss_file', PRJ, 'error_import_miss_file', '')
|
||||
ctx.run(EXIT_BAD_CONFIG)
|
||||
assert ctx.search_err(r"missing import file")
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_error_import_no_outputs(test_dir):
|
||||
ctx = context.TestContext(test_dir, 'test_error_import_no_outputs', PRJ, 'error_import_no_outputs', '')
|
||||
ctx.run()
|
||||
assert ctx.search_err(r"No outputs found in `(.*)drc.kibot.yaml`")
|
||||
ctx.clean_up()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
# Example KiBot config file for a basic 2-layer board
|
||||
kibot:
|
||||
version: 1
|
||||
|
||||
import:
|
||||
- foobar
|
||||
- bogus
|
||||
|
||||
outputs:
|
||||
- name: 'position'
|
||||
comment: "Pick and place file"
|
||||
type: position
|
||||
dir: positiondir
|
||||
options:
|
||||
format: ASCII # CSV or ASCII format
|
||||
units: millimeters # millimeters or inches
|
||||
separate_files_for_front_and_back: true
|
||||
only_smd: true
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# Example KiBot config file for a basic 2-layer board
|
||||
kibot:
|
||||
version: 1
|
||||
|
||||
import:
|
||||
- drc.kibot.yaml
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# Example KiBot config file for a basic 2-layer board
|
||||
kibot:
|
||||
version: 1
|
||||
|
||||
import:
|
||||
- 1
|
||||
- true
|
||||
|
||||
outputs:
|
||||
- name: 'position'
|
||||
comment: "Pick and place file"
|
||||
type: position
|
||||
dir: positiondir
|
||||
options:
|
||||
format: ASCII # CSV or ASCII format
|
||||
units: millimeters # millimeters or inches
|
||||
separate_files_for_front_and_back: true
|
||||
only_smd: true
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
# Example KiBot config file for a basic 2-layer board
|
||||
kibot:
|
||||
version: 1
|
||||
|
||||
import:
|
||||
can_not_use_dict: 1
|
||||
|
||||
outputs:
|
||||
- name: 'position'
|
||||
comment: "Pick and place file"
|
||||
type: position
|
||||
dir: positiondir
|
||||
options:
|
||||
format: ASCII # CSV or ASCII format
|
||||
units: millimeters # millimeters or inches
|
||||
separate_files_for_front_and_back: true
|
||||
only_smd: true
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# Example KiBot config file for a basic 2-layer board
|
||||
kibot:
|
||||
version: 1
|
||||
|
||||
import:
|
||||
- gerber_inner.kibot.yaml
|
||||
- ibom.kibot.yaml
|
||||
|
||||
outputs:
|
||||
- name: 'position'
|
||||
comment: "Pick and place file"
|
||||
type: position
|
||||
dir: positiondir
|
||||
options:
|
||||
format: ASCII # CSV or ASCII format
|
||||
units: millimeters # millimeters or inches
|
||||
separate_files_for_front_and_back: true
|
||||
only_smd: true
|
||||
Loading…
Reference in New Issue