Unverified Commit d9b3edec authored by Dannon's avatar Dannon Committed by GitHub
Browse files

Merge pull request #16480 from bernt-matthias/fix/profile-regex

[23.0] Linter: fix regex for profile version
parents 0205f9b3 4f3b8da9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ VALID_NAME_MSG = "Tool defines a name [%s]."
ERROR_ID_MSG = "Tool does not define an id attribute."
VALID_ID_MSG = "Tool defines an id [%s]."

PROFILE_PATTERN = re.compile(r"^[1,2]\d\.[0,1]\d$")
PROFILE_PATTERN = re.compile(r"^[12]\d\.\d{1,2}$")
PROFILE_INFO_DEFAULT_MSG = "Tool targets 16.01 Galaxy profile."
PROFILE_INFO_SPECIFIED_MSG = "Tool specifies profile version [%s]."
PROFILE_INVALID_MSG = "Tool specifies an invalid profile version [%s]."
+18 −0
Original line number Diff line number Diff line
@@ -109,6 +109,11 @@ GENERAL_VALID = """
</tool>
"""

GENERAL_VALID_NEW_PROFILE_FMT = """
<tool name="valid name" id="valid_id" version="1.0+galaxy1" profile="23.0">
</tool>
"""

# test tool xml for help linter
HELP_MULTIPLE = """
<tool>
@@ -1016,6 +1021,19 @@ def test_general_valid(lint_ctx):
    assert not lint_ctx.error_messages


def test_general_valid_new_profile_fmt(lint_ctx):
    tool_source = get_xml_tool_source(GENERAL_VALID_NEW_PROFILE_FMT)
    run_lint(lint_ctx, general.lint_general, XmlToolSource(tool_source))
    assert "Tool defines a version [1.0+galaxy1]." in lint_ctx.valid_messages
    assert "Tool specifies profile version [23.0]." in lint_ctx.valid_messages
    assert "Tool defines an id [valid_id]." in lint_ctx.valid_messages
    assert "Tool defines a name [valid name]." in lint_ctx.valid_messages
    assert not lint_ctx.info_messages
    assert len(lint_ctx.valid_messages) == 4
    assert not lint_ctx.warn_messages
    assert not lint_ctx.error_messages


def test_help_multiple(lint_ctx):
    tool_source = get_xml_tool_source(HELP_MULTIPLE)
    run_lint(lint_ctx, help.lint_help, tool_source)