[Tests][Import][Globals] more tests

This commit is contained in:
Salvador E. Tropea 2024-01-19 08:20:14 -03:00
parent 3d8146b075
commit f314cdaedb
12 changed files with 117 additions and 6 deletions

View File

@ -11,6 +11,7 @@
(page A4)
(title_block
(date 2024-01-19)
(comment 2 The_C2)
)

View File

@ -6,6 +6,7 @@
(paper "A4")
(title_block
(date "2024-01-19")
(comment 2 "The_C2")
)

View File

@ -6,6 +6,7 @@
(paper "A4")
(title_block
(date "2024-01-19")
(comment 2 "The_C2")
)
@ -307,7 +308,7 @@
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
)
)
(gr_rect (start 126.7 71.3) (end 140.9 87.9)
(stroke (width 0.05) (type default)) (fill none) (layer "Edge.Cuts") (tstamp d645f00e-19f1-43e7-8c43-ee0954e655cf))

View File

@ -6,6 +6,7 @@
(paper "A4")
(title_block
(date "2024-01-19")
(comment 2 "The_C2")
)

View File

@ -857,13 +857,44 @@ def test_import_1(test_dir):
ctx.clean_up()
def test_import_2(test_dir):
def test_import_g_1(test_dir):
""" Import a global option """
prj = 'test_v5'
ctx = context.TestContext(test_dir, prj, 'import_test_2')
ctx = context.TestContext(test_dir, prj, 'import_test_g_1')
ctx.run()
ctx.expect_out_file(POS_DIR+'/test_v5_(bottom_pos).pos')
ctx.expect_out_file(POS_DIR+'/test_v5_(top_pos).pos')
ctx.expect_out_file(POS_DIR+'/test_v5_(bottom_pos)_2024_01_19.pos')
ctx.expect_out_file(POS_DIR+'/test_v5_(top_pos)_2024_01_19.pos')
ctx.clean_up()
def test_import_g_2(test_dir):
""" Import a particular global option """
prj = 'test_v5'
ctx = context.TestContext(test_dir, prj, 'import_test_g_2')
ctx.run()
ctx.expect_out_file(POS_DIR+'/test_v5_(bottom_pos)_2024-01-19.pos')
ctx.expect_out_file(POS_DIR+'/test_v5_(top_pos)_2024-01-19.pos')
ctx.search_err(r"can't import `foobar`")
ctx.clean_up()
def test_import_g_3(test_dir):
""" Import a global option: not a dict """
prj = 'test_v5'
ctx = context.TestContext(test_dir, prj, 'import_test_g_3')
ctx.run(EXIT_BAD_CONFIG)
ctx.search_err(r"Incorrect `global` section")
ctx.clean_up()
def test_import_g_4(test_dir):
""" Import a global option: not a dict """
prj = 'test_v5'
ctx = context.TestContext(test_dir, prj, 'import_test_g_4')
ctx.run()
ctx.expect_out_file(POS_DIR+'/test_v5-bottom_pos.pos')
ctx.expect_out_file(POS_DIR+'/test_v5-top_pos.pos')
ctx.search_err(r"No globals found")
ctx.clean_up()

View File

@ -2,4 +2,5 @@ kibot:
version: 1
global:
output: '%f_(%i).%x'
output: '%f_(%i)_%d.%x'
date_format: '%Y_%m_%d'

View File

@ -0,0 +1,3 @@
kibot:
version: 1

View File

@ -0,0 +1,6 @@
kibot:
version: 1
global:
- output: '%f_(%i)_%d.%x'
- date_format: '%Y_%m_%d'

View File

@ -0,0 +1,22 @@
kibot:
version: 1
import:
# Here we change the global.output pattern
- file: global_import.kibot.yaml
globals: ['output', 'foobar']
global:
# The import will override it
output: '%f-%i.%x'
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

View File

@ -0,0 +1,22 @@
kibot:
version: 1
import:
# Here we change the global.output pattern
- file: global_import_bad_not_dict.kibot.yaml
globals: ['output', 'foobar']
global:
# The import will override it
output: '%f-%i.%x'
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

View File

@ -0,0 +1,22 @@
kibot:
version: 1
import:
# Here we change the global.output pattern
- file: global_import_bad_no_globals.kibot.yaml
globals: ['output', 'foobar']
global:
# The import will override it
output: '%f-%i.%x'
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