From 80df7d76c7fcfbe097fe93a76265a315943ed2ee Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Wed, 3 Feb 2021 12:31:39 -0300 Subject: [PATCH] Added tests to fully cover config_reader. - Output comment as None - Empty output name - Empty variant type --- tests/test_plot/test_yaml_errors.py | 16 +++++++++- .../yaml_samples/error_empty_name.kibot.yaml | 32 +++++++++++++++++++ .../error_var_empty_type.kibot.yaml | 7 ++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 tests/yaml_samples/error_empty_name.kibot.yaml create mode 100644 tests/yaml_samples/error_var_empty_type.kibot.yaml diff --git a/tests/test_plot/test_yaml_errors.py b/tests/test_plot/test_yaml_errors.py index 1d233837..220a7e99 100644 --- a/tests/test_plot/test_yaml_errors.py +++ b/tests/test_plot/test_yaml_errors.py @@ -223,7 +223,14 @@ def test_wrong_layer_8(test_dir): def test_no_name(test_dir): - ctx = context.TestContext(test_dir, 'ErrorNoName', '3Rs', 'error_no_name', None) + ctx = context.TestContext(test_dir, 'test_no_name', '3Rs', 'error_no_name', None) + ctx.run(EXIT_BAD_CONFIG) + assert ctx.search_err("Output needs a name") + ctx.clean_up() + + +def test_empty_name(test_dir): + ctx = context.TestContext(test_dir, 'test_empty_name', '3Rs', 'error_empty_name', None) ctx.run(EXIT_BAD_CONFIG) assert ctx.search_err("Output needs a name") ctx.clean_up() @@ -565,6 +572,13 @@ def test_error_var_no_type(test_dir): ctx.clean_up() +def test_error_var_empty_type(test_dir): + ctx = context.TestContextSCH(test_dir, 'test_error_var_empty_type', 'links', 'error_var_empty_type', '') + ctx.run(EXIT_BAD_CONFIG) + assert ctx.search_err("Variant (.*) needs a type") + ctx.clean_up() + + def test_error_var_no_list(test_dir): ctx = context.TestContextSCH(test_dir, 'test_error_var_no_list', 'links', 'error_var_no_list', '') ctx.run(EXIT_BAD_CONFIG) diff --git a/tests/yaml_samples/error_empty_name.kibot.yaml b/tests/yaml_samples/error_empty_name.kibot.yaml new file mode 100644 index 00000000..53721f02 --- /dev/null +++ b/tests/yaml_samples/error_empty_name.kibot.yaml @@ -0,0 +1,32 @@ +kibot: + version: 1 + +outputs: + - comment: + name: 'bogus' + type: pdf + + - comment: 'Test' + name: '' + type: pdf + dir: PDF + options: + exclude_edge_layer: false + exclude_pads_from_silkscreen: false + use_aux_axis_as_origin: false + plot_sheet_reference: false + plot_footprint_refs: true + plot_footprint_values: true + force_plot_invisible_refs_vals: false + tent_vias: true + + # PDF options + drill_marks: small + mirror_plot: false + negative_plot: false + line_width: 0.01 + layers: + - layer: F.Cu + suffix: F_Cu + - layer: F.Bogus + suffix: B_Silks diff --git a/tests/yaml_samples/error_var_empty_type.kibot.yaml b/tests/yaml_samples/error_var_empty_type.kibot.yaml new file mode 100644 index 00000000..e5bfc322 --- /dev/null +++ b/tests/yaml_samples/error_var_empty_type.kibot.yaml @@ -0,0 +1,7 @@ +kibot: + version: 1 + +variants: + - name: ok + type: '' +