fix typo in test linter

This commit is contained in:
Matthias Bernt
2022-08-29 11:36:59 +02:00
parent c096e599ff
commit a8a80cf431
2 changed files with 18 additions and 11 deletions
+2 -2
View File
@@ -97,9 +97,9 @@ def lint_tsts(tool_xml, lint_ctx):
discover_datasets = corresponding_output.find(".//discover_datasets")
if discover_datasets is not None:
if output.tag == "output":
if "count" not in output.attrib and output.find("./discovered_datasets") is None:
if "count" not in output.attrib and output.find("./discovered_dataset") is None:
lint_ctx.error(
f"Test {test_idx}: test output '{name}' must have a 'count' attribute and/or 'discovered_datasets' children",
f"Test {test_idx}: test output '{name}' must have a 'count' attribute and/or 'discovered_dataset' children",
node=output,
)
pass
+16 -9
View File
@@ -686,11 +686,18 @@ TESTS_DISCOVER_OUTPUTS = """
<tests>
<!-- this should be fine -->
<test>
<output name="data_name" count="2">
<discovered_data/>
<output name="data_name">
<discovered_dataset/>
</output>
<output_collection name="collection_name">
<element count="2">
<element count="2"/>
</output_collection>
</test>
<!-- this should be fine as well -->
<test>
<output name="data_name" count="2"/>
<output_collection name="collection_name">
<element>
<element/>
</element>
</output_collection>
@@ -1492,21 +1499,21 @@ def test_tests_discover_outputs(lint_ctx):
tool_source = get_xml_tool_source(TESTS_DISCOVER_OUTPUTS)
run_lint(lint_ctx, tests.lint_tsts, tool_source)
assert (
"Test 2: test output 'data_name' must have a 'count' attribute and/or 'discovered_datasets' children"
"Test 3: test output 'data_name' must have a 'count' attribute and/or 'discovered_dataset' children"
in lint_ctx.error_messages
)
assert (
"Test 2: test collection 'collection_name' must have a 'count' attribute or 'element' children"
in lint_ctx.error_messages
)
assert (
"Test 2: test collection 'collection_name' must contain nested 'element' tags and/or element childen with a 'count' attribute"
"Test 3: test collection 'collection_name' must have a 'count' attribute or 'element' children"
in lint_ctx.error_messages
)
assert (
"Test 3: test collection 'collection_name' must contain nested 'element' tags and/or element childen with a 'count' attribute"
in lint_ctx.error_messages
)
assert (
"Test 4: test collection 'collection_name' must contain nested 'element' tags and/or element childen with a 'count' attribute"
in lint_ctx.error_messages
)
assert not lint_ctx.warn_messages
assert len(lint_ctx.error_messages) == 4