From 95fd5cf28eaf8c41c60f686092708bd5b6b97b64 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Fri, 19 Jan 2024 09:30:01 -0300 Subject: [PATCH] [Tests][Import][Filters][Variants][Added] basic tests --- tests/test_plot/test_position.py | 4 ++++ .../rotation_filter_and_variant.kibot.yaml | 21 ++++++++++++++++++ .../simple_position_rot_1.kibot.yaml | 22 ++++--------------- 3 files changed, 29 insertions(+), 18 deletions(-) create mode 100644 tests/yaml_samples/rotation_filter_and_variant.kibot.yaml diff --git a/tests/test_plot/test_position.py b/tests/test_plot/test_position.py index 2b5b30a8..69e848c7 100644 --- a/tests/test_plot/test_position.py +++ b/tests/test_plot/test_position.py @@ -228,6 +228,8 @@ def test_position_variant_t2i(test_dir): def test_position_rot_1(test_dir): + """ Rotation filter inside a variant. + Also testing the import mechanism for them """ prj = 'light_control' ctx = context.TestContext(test_dir, prj, 'simple_position_rot_1', POS_DIR) ctx.run() @@ -235,6 +237,8 @@ def test_position_rot_1(test_dir): ctx.expect_out_file(output) ctx.compare_txt(output) ctx.compare_txt(prj+'_bom_jlc.csv') + ctx.search_err(r"can't import `foobar` filter") + ctx.search_err(r"can't import `foobar` variant") ctx.clean_up(keep_project=True) diff --git a/tests/yaml_samples/rotation_filter_and_variant.kibot.yaml b/tests/yaml_samples/rotation_filter_and_variant.kibot.yaml new file mode 100644 index 00000000..523ebf76 --- /dev/null +++ b/tests/yaml_samples/rotation_filter_and_variant.kibot.yaml @@ -0,0 +1,21 @@ +kibot: + version: 1 + +filters: + - name: fix_rotation + comment: 'Adjust rotation for JLC' + type: rot_footprint + + - name: only_jlc_parts + comment: 'Only parts with JLC code' + type: generic + include_only: + - column: 'LCSC#' + regex: '^C\d+' + +variants: + - name: rotated + comment: 'Just a place holder for the rotation filter' + type: kibom + variant: rotated + pre_transform: fix_rotation diff --git a/tests/yaml_samples/simple_position_rot_1.kibot.yaml b/tests/yaml_samples/simple_position_rot_1.kibot.yaml index 9cc7df3a..dcfc2c8a 100644 --- a/tests/yaml_samples/simple_position_rot_1.kibot.yaml +++ b/tests/yaml_samples/simple_position_rot_1.kibot.yaml @@ -1,24 +1,10 @@ kibot: version: 1 -filters: - - name: fix_rotation - comment: 'Adjust rotation for JLC' - type: rot_footprint - - - name: only_jlc_parts - comment: 'Only parts with JLC code' - type: generic - include_only: - - column: 'LCSC#' - regex: '^C\d+' - -variants: - - name: rotated - comment: 'Just a place holder for the rotation filter' - type: kibom - variant: rotated - pre_transform: fix_rotation +import: + - file: rotation_filter_and_variant.kibot.yaml + filters: ['fix_rotation', 'only_jlc_parts', 'foobar'] + variants: ['rotated', 'foobar'] outputs: - name: 'position'