Merge pull request #14526 from bernt-matthias/topic/fix-test-linters

[22.05] Fix typos in test linter
This commit is contained in:
Nicola Soranzo
2022-08-30 12:16:10 +01:00
committed by GitHub
6 changed files with 22 additions and 15 deletions
+1 -1
View File
@@ -220,7 +220,7 @@ Enhancements
`Pull Request 6480`_
* Use bootstrap vue classes for workflow import form
`Pull Request 6489`_
* Small improvement to the tool xsd docs regarding ``discovered_datasets``
* Small improvement to the tool xsd docs regarding ``discovered_dataset``
(thanks to `@bernt-matthias <https://github.com/bernt-matthias>`__).
`Pull Request 6490`_
* Implement ``group:`` tags (toward multi-factor analysis with group tagging)
+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
@@ -324,7 +324,7 @@ class ToolOutputCollectionStructure:
)
if dataset_collector_descriptions and (structured_like or collection_type_from_rules):
raise ValueError(
"Cannot specify dynamic structure (discovered_datasets) and collection type attributes structured_like or collection_type_from_rules."
"Cannot specify dynamic structure (discover_datasets) and collection type attributes structured_like or collection_type_from_rules."
)
self.dynamic = bool(dataset_collector_descriptions)
+1 -1
View File
@@ -1853,7 +1853,7 @@ provides a demonstration of using this tag.
</test>
```
Note that this tool uses ``assign_primary_output="true"`` for ``<discover_data_sets>``. Hence, the content of the first discovered dataset (which is the first in the alphabetically sorted list of discovered designations) is checked directly in the ``<output>`` tag of the test.
Note that this tool uses ``assign_primary_output="true"`` for ``<discover_datasets>``. Hence, the content of the first discovered dataset (which is the first in the alphabetically sorted list of discovered designations) is checked directly in the ``<output>`` tag of the test.
]]></xs:documentation>
</xs:annotation>
<xs:complexContent>
@@ -55,7 +55,7 @@ class CollectPrimaryDatasetsTestCase(unittest.TestCase, tools_support.UsesTools)
# Test default metadata stuff
assert created_hda_1.visible
# Since discovered_datasets not specified, older name based pattern
# Since discover_datasets not specified, older name based pattern
# didn't result in a dbkey being set.
assert created_hda_1.dbkey == "?"
+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