From 1fee4969bf88ace345f6c69870afb99781f965d5 Mon Sep 17 00:00:00 2001 From: fubar2 Date: Wed, 6 Sep 2023 20:17:43 +1000 Subject: [PATCH 01/21] IUC want profile in the and detect_errors in the Only way I could get it to work was to make command an XMLParam and add the command string as an etree.CDATA. It passes tests including a new one for the command but I'm not sure if this is the most efficient way to achieve this goal. --- galaxyxml/__init__.py | 8 +- galaxyxml/tool/__init__.py | 64 ++++++----- galaxyxml/tool/import_xml.py | 43 +++---- galaxyxml/tool/parameters/__init__.py | 155 ++++++++++++++------------ setup.py | 2 +- test/import_xml.xml | 6 +- test/unit_test_import_xml.py | 8 +- tox.ini | 16 ++- 8 files changed, 166 insertions(+), 136 deletions(-) diff --git a/galaxyxml/__init__.py b/galaxyxml/__init__.py index 38fc4a7..3a9a7c2 100644 --- a/galaxyxml/__init__.py +++ b/galaxyxml/__init__.py @@ -1,7 +1,4 @@ -from builtins import ( - object, - str -) +from builtins import object, str from lxml import etree @@ -36,8 +33,7 @@ def coerce(cls, data, kill_lists=False): @classmethod def coerce_value(cls, obj): - """Make everything a string! - """ + """Make everything a string!""" if isinstance(obj, bool): if obj: return "true" diff --git a/galaxyxml/tool/__init__.py b/galaxyxml/tool/__init__.py index c636cf2..7dc0a34 100644 --- a/galaxyxml/tool/__init__.py +++ b/galaxyxml/tool/__init__.py @@ -2,15 +2,7 @@ import logging from galaxyxml import GalaxyXML, Util -from galaxyxml.tool.parameters import ( - Expand, - Import, - Inputs, - Macro, - Macros, - Outputs, - XMLParam -) +from galaxyxml.tool.parameters import Expand, Import, Inputs, Macro, Macros, Outputs, XMLParam, Command from lxml import etree @@ -37,18 +29,23 @@ def __init__( version_command="interpreter filename.exe --version", command_override=None, macros=[], + profile="22.05", + detect_errors="aggressive", ): self.id = id + self.detect_errors = detect_errors self.executable = executable self.interpreter = interpreter self.command_override = command_override + self.profile = profile kwargs = { "name": name, "id": id, "version": version, "hidden": hidden, "workflow_compatible": workflow_compatible, + "profile": profile } self.version_command = version_command @@ -81,6 +78,7 @@ def __init__( self.macros.append(Import(m)) self.inputs = Inputs() self.outputs = Outputs() + self.command = Command() def add_comment(self, comment_txt): comment = etree.Comment(comment_txt) @@ -93,6 +91,7 @@ def append_version_command(self): except Exception: pass + def append(self, sub_node): if issubclass(type(sub_node), XMLParam): self.root.append(sub_node.node) @@ -146,37 +145,42 @@ def export(self, keep_old_command=False): export_xml.append_version_command() if self.command_override: - command_line = self.command_override + command_text = self.command_override else: - command_line = [] + command_text = [] try: - command_line.append(export_xml.inputs.cli()) + command_text.append(export_xml.inputs.cli()) except Exception as e: logger.warning(str(e)) raise try: - command_line.append(export_xml.outputs.cli()) + command_text.append(export_xml.outputs.cli()) except Exception: pass - # Steal interpreter from kwargs - command_kwargs = {} - if export_xml.interpreter is not None: - command_kwargs["interpreter"] = export_xml.interpreter - # Add command section - command_node = etree.SubElement(export_xml.root, "command", **command_kwargs) if keep_old_command: - if getattr(self, "command", None): - command_node.text = etree.CDATA(export_xml.command) + if getattr(self, "command_line", None): + ctext = export_xml.command_text else: logger.warning("The tool does not have any old command stored. Only the command line is written.") - command_node.text = export_xml.executable + ctext = export_xml.executable else: if self.command_override: - actual_cli = export_xml.clean_command_string(command_line) + actual_cli = export_xml.clean_command_string(command_text) else: - actual_cli = "%s %s" % (export_xml.executable, export_xml.clean_command_string(command_line),) - command_node.text = etree.CDATA(actual_cli.strip()) - export_xml.append(command_node) + actual_cli = "%s %s" % ( + export_xml.executable, + export_xml.clean_command_string(command_text), + ) + ctext = actual_cli.strip() + export_xml.command_text = ctext + ctext = '\n' + ctext # pretty - bjoern's suggestion + command_kwargs = {} + try: + command_element = export_xml.command + except Exception: + command_element = etree.SubElement(export_xml.root, "command", detect_errors="aggressive") + command_element.node.text = etree.CDATA(ctext) + export_xml.append(command_element) try: export_xml.append(export_xml.configfiles) @@ -226,13 +230,13 @@ class MacrosTool(Tool): TODO all other elements, like requirements are currently ignored """ + def __init__(self, *args, **kwargs): super(MacrosTool, self).__init__(*args, **kwargs) - self.root = etree.Element('macros') + self.root = etree.Element("macros") self.inputs = Macro("%s_inmacro" % self.id) self.outputs = Macro("%s_outmacro" % self.id) - def export(self, keep_old_command=False): # noqa export_xml = copy.deepcopy(self) @@ -251,7 +255,7 @@ def export(self, keep_old_command=False): # noqa raise # Add command section - command_node = etree.SubElement(export_xml.root, 'token', {"name": "%s_INMACRO" % self.id.upper()}) + command_node = etree.SubElement(export_xml.root, "token", {"name": "%s_INMACRO" % self.id.upper()}) actual_cli = "%s" % (export_xml.clean_command_string(command_line)) command_node.text = etree.CDATA(actual_cli.strip()) @@ -260,7 +264,7 @@ def export(self, keep_old_command=False): # noqa command_line.append(export_xml.outputs.cli()) except Exception: pass - command_node = etree.SubElement(export_xml.root, 'token', {"name": "%s_OUTMACRO" % self.id.upper()}) + command_node = etree.SubElement(export_xml.root, "token", {"name": "%s_OUTMACRO" % self.id.upper()}) actual_cli = "%s" % (export_xml.clean_command_string(command_line)) command_node.text = etree.CDATA(actual_cli.strip()) diff --git a/galaxyxml/tool/import_xml.py b/galaxyxml/tool/import_xml.py index 28e9178..19507b4 100644 --- a/galaxyxml/tool/import_xml.py +++ b/galaxyxml/tool/import_xml.py @@ -25,12 +25,10 @@ def _init_tool(self, xml_root): for child in xml_root: if child.tag == "description": description = child.text - elif child.tag == "command": - executable = child.text.split()[0] - command = child.text elif child.tag == "version_command": version_cmd = child.text - + elif child.tag == "command": + executable = child.text.split()[0] tool = gxt.Tool( xml_root.attrib["name"], xml_root.attrib["id"], @@ -43,7 +41,6 @@ def _init_tool(self, xml_root): workflow_compatible=xml_root.attrib.get("workflow_compatible", True), version_command=version_cmd, ) - tool.command = command return tool def _load_description(self, tool, desc_root): @@ -77,21 +74,24 @@ def _load_stdio(self, tool, stdio_root): """ tool.stdios = gxtp.Stdios() for std in stdio_root: - slevel = std.attrib['level'] - srange = std.attrib['range'] + slevel = std.attrib["level"] + srange = std.attrib["range"] tool.stdios.append(gxtp.Stdio(level=slevel, range=srange)) logger.info(" loaded.") - def _load_command(self, tool, desc_root): + def _load_command(self, tool, command_root): """ - is already loaded during initiation. - - :param tool: Tool object from galaxyxml. - :type tool: :class:`galaxyxml.tool.Tool` - :param desc_root: root of tag. - :type desc_root: :class:`xml.etree._Element` + now an XMLParameter with a text """ - logger.info(" is loaded during initiation of the object.") + detect_errors = "aggressive" + command = gxtp.Command(detect_errors = detect_errors) + ctext = getattr(command_root.node, text) + print('load_command text=', ctext) + command.node.text = ctext + tool.command_text = ctext + tool.command = command + tool.executable = ctext.split()[0] + logger.info(" is loaded.") def _load_help(self, tool, help_root): """ @@ -727,11 +727,12 @@ def _load_element(self, test_root, element_root): :param repeat_root: root of tag. :param repeat_root: :class:`xml.etree._Element` """ - test_root.append(gxtp.TestOCElement( - name=element_root.attrib.get("name", None), - ftype=element_root.attrib.get("ftype", None), - file=element_root.attrib.get("file", None) - ) + test_root.append( + gxtp.TestOCElement( + name=element_root.attrib.get("name", None), + ftype=element_root.attrib.get("ftype", None), + file=element_root.attrib.get("file", None), + ) ) def _load_repeat(self, test_root, repeat_root): @@ -747,7 +748,7 @@ def _load_repeat(self, test_root, repeat_root): repeat_root.attrib.get("title", None), min=repeat_root.attrib.get("min", None), max=repeat_root.attrib.get("max", None), - default=repeat_root.attrib.get("default", None) + default=repeat_root.attrib.get("default", None), ) # Deal with child nodes self.load_inputs(repeat, repeat_root) diff --git a/galaxyxml/tool/parameters/__init__.py b/galaxyxml/tool/parameters/__init__.py index ee9e647..1b0446e 100644 --- a/galaxyxml/tool/parameters/__init__.py +++ b/galaxyxml/tool/parameters/__init__.py @@ -1,8 +1,5 @@ import logging -from builtins import ( - object, - str -) +from builtins import object, str from galaxy.tool_util.parser.util import _parse_name @@ -37,7 +34,10 @@ def __getattr__(self, name): try: return self.node.attrib[name] except KeyError: - raise AttributeError(name) + try: + return object.__getattribute__(self,name) + except KeyError: + raise AttributeError(name) def append(self, sub_node): if self.acceptable_child(sub_node): @@ -78,6 +78,13 @@ def command_line(self, mako_path=None): """ return None +class Command(XMLParam): + name = "command" + + def __init__(self, detect_errors="aggressive", **kwargs): + params = Util.clean_kwargs(locals().copy()) + super(Command, self).__init__(**params) + class Stdios(XMLParam): name = "stdio" @@ -107,7 +114,7 @@ class Macro(XMLParam): def __init__(self, name): params = Util.clean_kwargs(locals().copy()) passed_kwargs = {} - passed_kwargs['name'] = params['name'] + passed_kwargs["name"] = params["name"] super(Macro, self).__init__(**passed_kwargs) def acceptable_child(self, child): @@ -129,12 +136,13 @@ class Expand(XMLParam): """ """ + name = "expand" def __init__(self, macro): params = Util.clean_kwargs(locals().copy()) passed_kwargs = {} - passed_kwargs['macro'] = params['macro'] + passed_kwargs["macro"] = params["macro"] super(Expand, self).__init__(**passed_kwargs) def command_line(self, mako_path=None): @@ -151,12 +159,13 @@ class ExpandIO(Expand): but an additional token with the same name but in upper case is added to the command section. can only be used in Inputs and Outputs """ + name = "expand" def __init__(self, macro): params = Util.clean_kwargs(locals().copy()) passed_kwargs = {} - passed_kwargs['macro'] = params['macro'] + passed_kwargs["macro"] = params["macro"] super(Expand, self).__init__(**passed_kwargs) def command_line(self, mako_path=None): @@ -170,8 +179,7 @@ def __init__(self, **kwargs): self.node = etree.Element(self.name) def acceptable_child(self, child): - return isinstance(child, RequestParamTranslation) \ - or isinstance(child, Expand) + return isinstance(child, RequestParamTranslation) or isinstance(child, Expand) class RequestParam(XMLParam): @@ -185,8 +193,7 @@ def __init__(self, galaxy_name, remote_name, missing, **kwargs): super(RequestParam, self).__init__(**params) def acceptable_child(self, child): - return isinstance(child, AppendParam) and self.galaxy_name == "URL" \ - or isinstance(child, Expand) + return isinstance(child, AppendParam) and self.galaxy_name == "URL" or isinstance(child, Expand) class AppendParam(XMLParam): @@ -215,8 +222,7 @@ class EdamOperations(XMLParam): name = "edam_operations" def acceptable_child(self, child): - return issubclass(type(child), EdamOperation) \ - or isinstance(child, Expand) + return issubclass(type(child), EdamOperation) or isinstance(child, Expand) def has_operation(self, edam_operation): """ @@ -242,8 +248,7 @@ class EdamTopics(XMLParam): name = "edam_topics" def acceptable_child(self, child): - return issubclass(type(child), EdamTopic) \ - or isinstance(child, Expand) + return issubclass(type(child), EdamTopic) or isinstance(child, Expand) def has_topic(self, edam_topic): """ @@ -270,9 +275,7 @@ class Requirements(XMLParam): # This bodes to be an issue -__- def acceptable_child(self, child): - return issubclass(type(child), Requirement) \ - or issubclass(type(child), Container) \ - or isinstance(child, Expand) + return issubclass(type(child), Requirement) or issubclass(type(child), Container) or isinstance(child, Expand) class Requirement(XMLParam): @@ -302,9 +305,11 @@ class Configfiles(XMLParam): name = "configfiles" def acceptable_child(self, child): - return issubclass(type(child), Configfile) \ - or issubclass(type(child), ConfigfileDefaultInputs) \ + return ( + issubclass(type(child), Configfile) + or issubclass(type(child), ConfigfileDefaultInputs) or isinstance(child, Expand) + ) class Configfile(XMLParam): @@ -337,18 +342,20 @@ def __init__(self, action=None, check_value=None, method=None, target=None, ngin super(Inputs, self).__init__(**params) def acceptable_child(self, child): - return issubclass(type(child), InputParameter) \ - or issubclass(type(child), Expand) \ + return ( + issubclass(type(child), InputParameter) + or issubclass(type(child), Expand) or issubclass(type(child), ExpandIO) + ) class InputParameter(XMLParam): def __init__(self, name, **kwargs): # TODO: look at - if "argument" in kwargs and kwargs['argument']: - self.flag_identifier = kwargs['argument'].lstrip() - self.num_dashes = len(kwargs['argument']) - len(self.flag_identifier) - self.mako_identifier = _parse_name(name, kwargs['argument']) + if "argument" in kwargs and kwargs["argument"]: + self.flag_identifier = kwargs["argument"].lstrip() + self.num_dashes = len(kwargs["argument"]) - len(self.flag_identifier) + self.mako_identifier = _parse_name(name, kwargs["argument"]) else: self.flag_identifier = name self.mako_identifier = name @@ -379,8 +386,8 @@ def __init__(self, name, **kwargs): if len(self.flag()) > 0: if kwargs["label"] is None: kwargs["label"] = "Author did not provide help for this parameter... " -# if not self.positional and "argument" not in kwargs: -# kwargs["argument"] = self.flag() + # if not self.positional and "argument" not in kwargs: + # kwargs["argument"] = self.flag() super(InputParameter, self).__init__(**kwargs) @@ -442,8 +449,7 @@ def command_line(self, mako_path=None): return "\n".join(cli) def acceptable_child(self, child): - return issubclass(type(child), InputParameter) \ - or isinstance(child, Expand) + return issubclass(type(child), InputParameter) or isinstance(child, Expand) class Repeat(InputParameter): @@ -460,8 +466,7 @@ def command_line_after(self): return "#end for" def acceptable_child(self, child): - return issubclass(type(child), InputParameter) \ - or isinstance(child, Expand) + return issubclass(type(child), InputParameter) or isinstance(child, Expand) def command_line_actual(self, mako_path): lines = [] @@ -486,7 +491,8 @@ def acceptable_child(self, child): return True else: return False -# return issubclass(type(child), InputParameter) and not isinstance(child, Conditional) + + # return issubclass(type(child), InputParameter) and not isinstance(child, Conditional) def command_line(self, mako_path=None): lines = [] @@ -495,7 +501,7 @@ def command_line(self, mako_path=None): continue lines.append('#if str(%s) == "%s"' % (self.children[0].mako_name(mako_path), c.value)) lines.append(c.cli()) - lines.append('#end if') + lines.append("#end if") return "\n".join(lines) def validate(self): @@ -511,8 +517,7 @@ def __init__(self, value): super(When, self).__init__(None, **params) def acceptable_child(self, child): - return issubclass(type(child), InputParameter) \ - or isinstance(child, Expand) + return issubclass(type(child), InputParameter) or isinstance(child, Expand) class Param(InputParameter): @@ -521,18 +526,16 @@ class Param(InputParameter): # This...isn't really valid as-is, and shouldn't be used. def __init__(self, name, argument=None, value=None, optional=None, label=None, help=None, **kwargs): params = Util.clean_kwargs(locals().copy()) - params = dict([("name", params["name"]), - ("argument", params["argument"]), - ("type", self.type)] + list(params.items())) + params = dict( + [("name", params["name"]), ("argument", params["argument"]), ("type", self.type)] + list(params.items()) + ) super(Param, self).__init__(**params) if type(self) == Param: raise Exception("Param class is not an actual parameter type, use a subclass of Param") def acceptable_child(self, child): - return issubclass(type(child), InputParameter) \ - or isinstance(child, ValidatorParam) \ - or isinstance(child, Expand) + return issubclass(type(child), InputParameter) or isinstance(child, ValidatorParam) or isinstance(child, Expand) class TextParam(Param): @@ -571,7 +574,16 @@ class BooleanParam(Param): type = "boolean" def __init__( - self, name, argument=None, optional=None, checked=False, truevalue=None, falsevalue=None, label=None, help=None, **kwargs + self, + name, + argument=None, + optional=None, + checked=False, + truevalue=None, + falsevalue=None, + label=None, + help=None, + **kwargs, ): params = Util.clean_kwargs(locals().copy()) @@ -638,9 +650,7 @@ def __init__( self.append(SelectOption(k, v, selected=selected)) def acceptable_child(self, child): - return issubclass(type(child), SelectOption) \ - or issubclass(type(child), Options) \ - or isinstance(child, Expand) + return issubclass(type(child), SelectOption) or issubclass(type(child), Options) or isinstance(child, Expand) class SelectOption(InputParameter): @@ -666,9 +676,7 @@ def __init__(self, from_dataset=None, from_file=None, from_data_table=None, from super(Options, self).__init__(None, **params) def acceptable_child(self, child): - return issubclass(type(child), Column) \ - or issubclass(type(child), Filter) \ - or isinstance(child, Expand) + return issubclass(type(child), Column) or issubclass(type(child), Filter) or isinstance(child, Expand) class Column(InputParameter): @@ -724,15 +732,16 @@ class Outputs(XMLParam): name = "outputs" def acceptable_child(self, child): - return isinstance(child, OutputData) \ - or isinstance(child, OutputCollection) \ - or isinstance(child, Expand) \ + return ( + isinstance(child, OutputData) + or isinstance(child, OutputCollection) + or isinstance(child, Expand) or isinstance(child, ExpandIO) + ) class OutputData(XMLParam): - """Copypasta of InputParameter, needs work - """ + """Copypasta of InputParameter, needs work""" name = "data" @@ -774,10 +783,12 @@ def flag(self): return flag + self.mako_identifier def acceptable_child(self, child): - return isinstance(child, OutputFilter) \ - or isinstance(child, ChangeFormat) \ - or isinstance(child, DiscoverDatasets) \ + return ( + isinstance(child, OutputFilter) + or isinstance(child, ChangeFormat) + or isinstance(child, DiscoverDatasets) or isinstance(child, Expand) + ) class OutputFilter(XMLParam): @@ -801,8 +812,7 @@ def __init__(self, **kwargs): super(ChangeFormat, self).__init__(**params) def acceptable_child(self, child): - return isinstance(child, ChangeFormatWhen) \ - or isinstance(child, Expand) + return isinstance(child, ChangeFormatWhen) or isinstance(child, Expand) class ChangeFormatWhen(XMLParam): @@ -861,19 +871,20 @@ class Tests(XMLParam): name = "tests" def acceptable_child(self, child): - return issubclass(type(child), Test) \ - or isinstance(child, Expand) + return issubclass(type(child), Test) or isinstance(child, Expand) class Test(XMLParam): name = "test" def acceptable_child(self, child): - return isinstance(child, TestParam) \ - or isinstance(child, TestOutput) \ - or isinstance(child, TestOutputCollection) \ - or isinstance(child, TestRepeat) \ + return ( + isinstance(child, TestParam) + or isinstance(child, TestOutput) + or isinstance(child, TestOutputCollection) + or isinstance(child, TestRepeat) or isinstance(child, Expand) + ) class TestParam(XMLParam): @@ -964,9 +975,11 @@ def __init__( super(TestRepeat, self).__init__(**params) def acceptable_child(self, child): - return issubclass(type(child), TestParam) \ - or issubclass(type(child), TestOutput) \ + return ( + issubclass(type(child), TestParam) + or issubclass(type(child), TestOutput) or issubclass(type(child), TestOutputCollection) + ) def command_line_before(self, mako_path): return "" % self.name @@ -985,8 +998,7 @@ class Citations(XMLParam): name = "citations" def acceptable_child(self, child): - return issubclass(type(child), Citation) \ - or isinstance(child, Expand) + return issubclass(type(child), Citation) or isinstance(child, Expand) def has_citation(self, type, value): """ @@ -996,8 +1008,7 @@ def has_citation(self, type, value): :type value: STRING """ for citation in self.children: - if citation.node.attrib['type'] == type \ - and citation.node.text == value: + if citation.node.attrib["type"] == type and citation.node.text == value: return True return False diff --git a/setup.py b/setup.py index 762a7d0..af18d01 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="galaxyxml", - version="0.4.14", + version="0.4.15", description="Galaxy XML generation library", author="Helena Rasche", author_email="hxr@hx42.org", diff --git a/test/import_xml.xml b/test/import_xml.xml index c1656d6..f0af099 100644 --- a/test/import_xml.xml +++ b/test/import_xml.xml @@ -1,5 +1,5 @@ - + description operation_0004 @@ -18,7 +18,9 @@ v_command - + + + diff --git a/test/unit_test_import_xml.py b/test/unit_test_import_xml.py index 0c7d18d..bc8d2a5 100644 --- a/test/unit_test_import_xml.py +++ b/test/unit_test_import_xml.py @@ -12,7 +12,6 @@ def setUp(self): gxp = GalaxyXmlParser() self.tool = gxp.import_xml("test/import_xml.xml") - class TestStdios(TestImport): def test_stdio(self): std = self.tool.stdios.children[0].node @@ -27,8 +26,14 @@ def test_override(self): exml = self.tool.export() self.assertEqual(self.tool.command_override, col) exml = exml.replace("\n", " ") + print("-----------exml", exml) self.assertTrue(co in exml) +class TestCommand(TestImport): + def test_command(self): + de = self.tool.command.node.attrib["detect_errors"] + self.assertEqual(de, "aggressive") + class TestImportXml(TestImport): def test_init_tool(self): @@ -36,6 +41,7 @@ def test_init_tool(self): self.assertEqual(xml_root.attrib["id"], "import_test") self.assertEqual(xml_root.attrib["name"], "Import") self.assertEqual(xml_root.attrib["version"], "1.0") + self.assertEqual(xml_root.attrib["profile"], "22.05") self.assertEqual(xml_root[0].text, "description") def test_load_help(self): diff --git a/tox.ini b/tox.ini index 61e9aca..c6c5c9d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,3 +1,13 @@ -[flake8] -max-line-length = 230 -max-complexity = 10 +[tox] +env_list = + py310 +minversion = 4.11.1 + +[testenv] +description = run the tests with pytest +package = wheel +wheel_build_env = .pkg +deps = + pytest>=6 +commands = + pytest test/unit_test_import_xml.py {tty:--color=yes} {posargs} From 0139b27687b98dc718a334eb7ea57a03e99562e9 Mon Sep 17 00:00:00 2001 From: fubar2 Date: Wed, 6 Sep 2023 20:59:37 +1000 Subject: [PATCH 02/21] tox ini does the needful and runs the unit tests why not? --- tox.ini | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index c6c5c9d..36a5870 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,9 @@ env_list = py310 minversion = 4.11.1 - +[flake8] +max-line-length = 230 +max-complexity = 10 [testenv] description = run the tests with pytest package = wheel From eb30341047dcf377b69d9db453ba0665fbf0a5b5 Mon Sep 17 00:00:00 2001 From: fubar2 Date: Wed, 6 Sep 2023 22:12:35 +1000 Subject: [PATCH 03/21] cleanup. is good. is xml. --- galaxyxml/tool/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/galaxyxml/tool/__init__.py b/galaxyxml/tool/__init__.py index 7dc0a34..1deb121 100644 --- a/galaxyxml/tool/__init__.py +++ b/galaxyxml/tool/__init__.py @@ -30,11 +30,9 @@ def __init__( command_override=None, macros=[], profile="22.05", - detect_errors="aggressive", ): self.id = id - self.detect_errors = detect_errors self.executable = executable self.interpreter = interpreter self.command_override = command_override From 2127d0a9272ee15b0ef70ca0b4dd725de5e8f887 Mon Sep 17 00:00:00 2001 From: fubar2 Date: Thu, 7 Sep 2023 09:54:01 +1000 Subject: [PATCH 04/21] Tweaks to ensure the detect_errors value is indeed controlled. That old problem of the galaxy utility libs being stuck at 23.05 is biting. I wonder when they will be updated and all the downstream packages? ` File "/home/ross/rossgit/galaxyxml/.venv/lib/python3.10/site-packages/galaxy_tool_util-23.0.5-py3.10.egg/galaxy/tool_util/deps/conda_util.py", line 90, in CondaContext _conda_version: Optional[Union[packaging.version.Version, packaging.version.LegacyVersion]] AttributeError: module 'packaging.version' has no attribute 'LegacyVersion' ` --- galaxyxml/tool/__init__.py | 12 +++++------- galaxyxml/tool/import_xml.py | 5 ++--- test/import_xml.xml | 2 +- test/unit_test_import_xml.py | 4 +++- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/galaxyxml/tool/__init__.py b/galaxyxml/tool/__init__.py index 1deb121..da77820 100644 --- a/galaxyxml/tool/__init__.py +++ b/galaxyxml/tool/__init__.py @@ -131,13 +131,11 @@ def export(self, keep_old_command=False): stdio_element = export_xml.stdios except Exception: stdio_element = None - if not stdio_element: - stdio_element = etree.SubElement(export_xml.root, "stdio") - etree.SubElement(stdio_element, "exit_code", range="1:", level="fatal") - try: - export_xml.append(stdio_element) - except Exception: - export_xml.append(Expand(macro="stdio")) + if stdio_element: + try: + export_xml.append(stdio_element) + except Exception: + export_xml.append(Expand(macro="stdio")) # Append version command export_xml.append_version_command() diff --git a/galaxyxml/tool/import_xml.py b/galaxyxml/tool/import_xml.py index 19507b4..58fabfe 100644 --- a/galaxyxml/tool/import_xml.py +++ b/galaxyxml/tool/import_xml.py @@ -83,10 +83,9 @@ def _load_command(self, tool, command_root): """ now an XMLParameter with a text """ - detect_errors = "aggressive" + detect_errors = command_root.attrib['detect_errors'] + ctext = command_root.text command = gxtp.Command(detect_errors = detect_errors) - ctext = getattr(command_root.node, text) - print('load_command text=', ctext) command.node.text = ctext tool.command_text = ctext tool.command = command diff --git a/test/import_xml.xml b/test/import_xml.xml index f0af099..69f08c4 100644 --- a/test/import_xml.xml +++ b/test/import_xml.xml @@ -18,7 +18,7 @@ v_command - + diff --git a/test/unit_test_import_xml.py b/test/unit_test_import_xml.py index bc8d2a5..0f22a09 100644 --- a/test/unit_test_import_xml.py +++ b/test/unit_test_import_xml.py @@ -32,7 +32,9 @@ def test_override(self): class TestCommand(TestImport): def test_command(self): de = self.tool.command.node.attrib["detect_errors"] - self.assertEqual(de, "aggressive") + self.assertEqual(de, "foo!") + ctext = self.tool.command.node.text + self.assertEqual(ctext.strip(), "command") class TestImportXml(TestImport): From 7d361014e73890f36466d9b9103003a6115ff94d Mon Sep 17 00:00:00 2001 From: fubar2 Date: Thu, 7 Sep 2023 10:14:32 +1000 Subject: [PATCH 05/21] add another unit test to demonstrate mutability for profile and detect error user set values --- test/unit_test_import_xml.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/unit_test_import_xml.py b/test/unit_test_import_xml.py index 0f22a09..b8504c3 100644 --- a/test/unit_test_import_xml.py +++ b/test/unit_test_import_xml.py @@ -36,6 +36,13 @@ def test_command(self): ctext = self.tool.command.node.text self.assertEqual(ctext.strip(), "command") +class TestChangeProfDet(TestImport): + def test_changes(self): + self.tool.command.node.attrib["detect_errors"] = "foobarfoo" + de = self.tool.command.node.attrib["detect_errors"] + self.assertEqual(de, "foobarfoo") + self.tool.profile = "anything you want" + self.assertEqual(self.tool.profile, "anything you want") class TestImportXml(TestImport): def test_init_tool(self): From b55f3bf458213ff8844a917a40039dccbb85cb37 Mon Sep 17 00:00:00 2001 From: fubar2 Date: Thu, 7 Sep 2023 16:14:55 +1000 Subject: [PATCH 06/21] changed default to just profile. No detect_errors. seems just fine. --- galaxyxml/tool/__init__.py | 2 +- galaxyxml/tool/import_xml.py | 7 +++++-- galaxyxml/tool/parameters/__init__.py | 2 +- test/import_xml.xml | 2 +- test/unit_test_import_xml.py | 7 +++++-- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/galaxyxml/tool/__init__.py b/galaxyxml/tool/__init__.py index da77820..2523c09 100644 --- a/galaxyxml/tool/__init__.py +++ b/galaxyxml/tool/__init__.py @@ -174,7 +174,7 @@ def export(self, keep_old_command=False): try: command_element = export_xml.command except Exception: - command_element = etree.SubElement(export_xml.root, "command", detect_errors="aggressive") + command_element = etree.SubElement(export_xml.root, "command", detect_errors=None) command_element.node.text = etree.CDATA(ctext) export_xml.append(command_element) diff --git a/galaxyxml/tool/import_xml.py b/galaxyxml/tool/import_xml.py index 58fabfe..83f0e8c 100644 --- a/galaxyxml/tool/import_xml.py +++ b/galaxyxml/tool/import_xml.py @@ -83,14 +83,17 @@ def _load_command(self, tool, command_root): """ now an XMLParameter with a text """ - detect_errors = command_root.attrib['detect_errors'] + try: + detect_errors = command_root.attrib['detect_errors'] + except KeyError: + detect_errors = None ctext = command_root.text command = gxtp.Command(detect_errors = detect_errors) command.node.text = ctext tool.command_text = ctext tool.command = command tool.executable = ctext.split()[0] - logger.info(" is loaded.") + def _load_help(self, tool, help_root): """ diff --git a/galaxyxml/tool/parameters/__init__.py b/galaxyxml/tool/parameters/__init__.py index 1b0446e..896fa6b 100644 --- a/galaxyxml/tool/parameters/__init__.py +++ b/galaxyxml/tool/parameters/__init__.py @@ -81,7 +81,7 @@ def command_line(self, mako_path=None): class Command(XMLParam): name = "command" - def __init__(self, detect_errors="aggressive", **kwargs): + def __init__(self, detect_errors=None, **kwargs): params = Util.clean_kwargs(locals().copy()) super(Command, self).__init__(**params) diff --git a/test/import_xml.xml b/test/import_xml.xml index 69f08c4..b4eca22 100644 --- a/test/import_xml.xml +++ b/test/import_xml.xml @@ -18,7 +18,7 @@ v_command - + diff --git a/test/unit_test_import_xml.py b/test/unit_test_import_xml.py index b8504c3..14fa65c 100644 --- a/test/unit_test_import_xml.py +++ b/test/unit_test_import_xml.py @@ -31,8 +31,11 @@ def test_override(self): class TestCommand(TestImport): def test_command(self): - de = self.tool.command.node.attrib["detect_errors"] - self.assertEqual(de, "foo!") + try: + de = self.tool.command.node.attrib["detect_errors"] + except KeyError: + de = None + self.assertEqual(de, None) ctext = self.tool.command.node.text self.assertEqual(ctext.strip(), "command") From a4ae18ed8ca22c48c683713b6ff08814ef50d19a Mon Sep 17 00:00:00 2001 From: Helena Rasche Date: Wed, 13 Sep 2023 10:50:20 +0200 Subject: [PATCH 07/21] Not the job of this library --- galaxyxml/tool/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/galaxyxml/tool/__init__.py b/galaxyxml/tool/__init__.py index 2523c09..13146bd 100644 --- a/galaxyxml/tool/__init__.py +++ b/galaxyxml/tool/__init__.py @@ -169,7 +169,6 @@ def export(self, keep_old_command=False): ) ctext = actual_cli.strip() export_xml.command_text = ctext - ctext = '\n' + ctext # pretty - bjoern's suggestion command_kwargs = {} try: command_element = export_xml.command From cf071aa2e8d0d3471b41fcb36be5364cb7072407 Mon Sep 17 00:00:00 2001 From: Helena Rasche Date: Wed, 13 Sep 2023 10:51:56 +0200 Subject: [PATCH 08/21] Ensure tests pass --- examples/tool.xml | 4 ---- galaxyxml/tool/__init__.py | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/tool.xml b/examples/tool.xml index 2347717..9e11993 100644 --- a/examples/tool.xml +++ b/examples/tool.xml @@ -5,10 +5,6 @@ samtools one_super_image - - - - Date: Wed, 13 Sep 2023 11:12:31 +0200 Subject: [PATCH 09/21] cleanup tox, pass tests --- test/{unit_test_import_xml.py => test_import.py} | 1 - tox.ini | 9 ++------- 2 files changed, 2 insertions(+), 8 deletions(-) rename test/{unit_test_import_xml.py => test_import.py} (99%) diff --git a/test/unit_test_import_xml.py b/test/test_import.py similarity index 99% rename from test/unit_test_import_xml.py rename to test/test_import.py index 14fa65c..4bf8a09 100644 --- a/test/unit_test_import_xml.py +++ b/test/test_import.py @@ -53,7 +53,6 @@ def test_init_tool(self): self.assertEqual(xml_root.attrib["id"], "import_test") self.assertEqual(xml_root.attrib["name"], "Import") self.assertEqual(xml_root.attrib["version"], "1.0") - self.assertEqual(xml_root.attrib["profile"], "22.05") self.assertEqual(xml_root[0].text, "description") def test_load_help(self): diff --git a/tox.ini b/tox.ini index 36a5870..5e5154a 100644 --- a/tox.ini +++ b/tox.ini @@ -6,10 +6,5 @@ minversion = 4.11.1 max-line-length = 230 max-complexity = 10 [testenv] -description = run the tests with pytest -package = wheel -wheel_build_env = .pkg -deps = - pytest>=6 -commands = - pytest test/unit_test_import_xml.py {tty:--color=yes} {posargs} +deps = pytest +commands = pytest test {posargs} From 4b974f39adfb4add2feed94c2050e1876c8ea025 Mon Sep 17 00:00:00 2001 From: Helena Rasche Date: Wed, 13 Sep 2023 11:20:43 +0200 Subject: [PATCH 10/21] cleanup the tox --- tox.ini | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tox.ini b/tox.ini index 5e5154a..27d8501 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,22 @@ [tox] -env_list = - py310 -minversion = 4.11.1 +env_list = py{38,310}-lint, py{38,310}-test +source_dir = galaxyxml +test_dir = test + [flake8] max-line-length = 230 max-complexity = 10 +ignore = E2,E3,E4,E5,W3,W505,C901,E501,E128,E203,E402,E501,E741,W503,W504, +exclude = .ci, .git, .tox, .venv + + [testenv] -deps = pytest -commands = pytest test {posargs} +deps = + lint: flake8 + lint: black + test: pytest + +commands = + lint: flake8 + lint: black --check --diff . + test: pytest From 98d0728401cf299021eb58527fc033457ee661d6 Mon Sep 17 00:00:00 2001 From: fubar2 Date: Mon, 18 Sep 2023 14:56:59 +1000 Subject: [PATCH 11/21] trying to undo lots of overdo. --- examples/tool.xml | 4 ++++ galaxyxml/__init__.py | 3 ++- galaxyxml/tool/__init__.py | 28 ++++++++++++++-------------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/examples/tool.xml b/examples/tool.xml index 9e11993..2347717 100644 --- a/examples/tool.xml +++ b/examples/tool.xml @@ -5,6 +5,10 @@ samtools one_super_image + + + + Date: Mon, 18 Sep 2023 15:11:19 +1000 Subject: [PATCH 12/21] not saved.. --- galaxyxml/tool/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/galaxyxml/tool/__init__.py b/galaxyxml/tool/__init__.py index 2ca1c0e..f346fdd 100644 --- a/galaxyxml/tool/__init__.py +++ b/galaxyxml/tool/__init__.py @@ -153,12 +153,14 @@ def export(self, keep_old_command=False): command_line.append(export_xml.outputs.cli()) except Exception: pass + # Add command section + command_node_text = None if keep_old_command: if getattr(self, "command", None): command_node.text = etree.CDATA(export_xml.command) else: logger.warning("The tool does not have any old command stored. Only the command line is written.") - command_node.text = export_xml.executable + command_node_text = export_xml.executable else: if self.command_override: actual_cli = export_xml.clean_command_string(command_line) @@ -167,14 +169,14 @@ def export(self, keep_old_command=False): export_xml.executable, export_xml.clean_command_string(command_line), ) - command_node.text = actual_cli.strip() - export_xml.command_line = ctext + command_node_text = actual_cli.strip() + export_xml.command_line = command_node_text command_kwargs = {} try: command_element = export_xml.command except Exception: command_element = etree.SubElement(export_xml.root, "command", detect_errors=None) - command_element.node.text = etree.CDATA(ctext) + command_element.node.text = etree.CDATA(command_node_text) export_xml.append(command_element) try: From 4825ce0604120bdb22b2edf8010d2a0ab6d413dd Mon Sep 17 00:00:00 2001 From: fubar2 Date: Mon, 18 Sep 2023 15:37:55 +1000 Subject: [PATCH 13/21] reformat during tests... --- galaxyxml/tool/import_xml.py | 7 +++++-- galaxyxml/tool/parameters/__init__.py | 17 ++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/galaxyxml/tool/import_xml.py b/galaxyxml/tool/import_xml.py index 83f0e8c..a9932d2 100644 --- a/galaxyxml/tool/import_xml.py +++ b/galaxyxml/tool/import_xml.py @@ -81,7 +81,10 @@ def _load_stdio(self, tool, stdio_root): def _load_command(self, tool, command_root): """ - now an XMLParameter with a text + :param tool: Tool object from galaxyxml. + :type tool: :class:`galaxyxml.tool.Tool` + :param desc_root: root of tag. + :type desc_root: :class:`xml.etree._Element` """ try: detect_errors = command_root.attrib['detect_errors'] @@ -90,7 +93,7 @@ def _load_command(self, tool, command_root): ctext = command_root.text command = gxtp.Command(detect_errors = detect_errors) command.node.text = ctext - tool.command_text = ctext + tool.command_line = ctext tool.command = command tool.executable = ctext.split()[0] diff --git a/galaxyxml/tool/parameters/__init__.py b/galaxyxml/tool/parameters/__init__.py index 896fa6b..c9ab8b7 100644 --- a/galaxyxml/tool/parameters/__init__.py +++ b/galaxyxml/tool/parameters/__init__.py @@ -1,6 +1,8 @@ import logging -from builtins import object, str - +from builtins import ( + object, + str +) from galaxy.tool_util.parser.util import _parse_name from galaxyxml import Util @@ -34,10 +36,7 @@ def __getattr__(self, name): try: return self.node.attrib[name] except KeyError: - try: - return object.__getattribute__(self,name) - except KeyError: - raise AttributeError(name) + raise AttributeError(name) def append(self, sub_node): if self.acceptable_child(sub_node): @@ -114,7 +113,7 @@ class Macro(XMLParam): def __init__(self, name): params = Util.clean_kwargs(locals().copy()) passed_kwargs = {} - passed_kwargs["name"] = params["name"] + passed_kwargs['name'] = params['name'] super(Macro, self).__init__(**passed_kwargs) def acceptable_child(self, child): @@ -142,7 +141,7 @@ class Expand(XMLParam): def __init__(self, macro): params = Util.clean_kwargs(locals().copy()) passed_kwargs = {} - passed_kwargs["macro"] = params["macro"] + passed_kwargs['macro'] = params['macro'] super(Expand, self).__init__(**passed_kwargs) def command_line(self, mako_path=None): @@ -165,7 +164,7 @@ class ExpandIO(Expand): def __init__(self, macro): params = Util.clean_kwargs(locals().copy()) passed_kwargs = {} - passed_kwargs["macro"] = params["macro"] + passed_kwargs['macro'] = params['macro'] super(Expand, self).__init__(**passed_kwargs) def command_line(self, mako_path=None): From 5419d67095c1fe0559466de08694612ccdbe48cd Mon Sep 17 00:00:00 2001 From: fubar2 Date: Mon, 18 Sep 2023 15:46:17 +1000 Subject: [PATCH 14/21] get rid of notional test.. --- test/test_import.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/test/test_import.py b/test/test_import.py index 4bf8a09..90f4c0f 100644 --- a/test/test_import.py +++ b/test/test_import.py @@ -39,14 +39,6 @@ def test_command(self): ctext = self.tool.command.node.text self.assertEqual(ctext.strip(), "command") -class TestChangeProfDet(TestImport): - def test_changes(self): - self.tool.command.node.attrib["detect_errors"] = "foobarfoo" - de = self.tool.command.node.attrib["detect_errors"] - self.assertEqual(de, "foobarfoo") - self.tool.profile = "anything you want" - self.assertEqual(self.tool.profile, "anything you want") - class TestImportXml(TestImport): def test_init_tool(self): xml_root = self.tool.root From 683b133685197119c765bf550139516cf5366326 Mon Sep 17 00:00:00 2001 From: fubar2 Date: Mon, 18 Sep 2023 15:55:56 +1000 Subject: [PATCH 15/21] revert order in init --- galaxyxml/tool/import_xml.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/galaxyxml/tool/import_xml.py b/galaxyxml/tool/import_xml.py index a9932d2..faec884 100644 --- a/galaxyxml/tool/import_xml.py +++ b/galaxyxml/tool/import_xml.py @@ -25,10 +25,11 @@ def _init_tool(self, xml_root): for child in xml_root: if child.tag == "description": description = child.text - elif child.tag == "version_command": - version_cmd = child.text elif child.tag == "command": executable = child.text.split()[0] + elif child.tag == "version_command": + version_cmd = child.text + tool = gxt.Tool( xml_root.attrib["name"], xml_root.attrib["id"], From 9a7af550dfab3399b521a4650b167caa895f7f63 Mon Sep 17 00:00:00 2001 From: fubar2 Date: Tue, 19 Sep 2023 14:52:57 +1000 Subject: [PATCH 16/21] eeesh. Found a bad refactor booboo. --- galaxyxml/tool/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galaxyxml/tool/__init__.py b/galaxyxml/tool/__init__.py index f346fdd..c6f8329 100644 --- a/galaxyxml/tool/__init__.py +++ b/galaxyxml/tool/__init__.py @@ -157,7 +157,7 @@ def export(self, keep_old_command=False): command_node_text = None if keep_old_command: if getattr(self, "command", None): - command_node.text = etree.CDATA(export_xml.command) + command_node_text = etree.CDATA(export_xml.command) else: logger.warning("The tool does not have any old command stored. Only the command line is written.") command_node_text = export_xml.executable From d7d3d3c20485b38647057cf4933d5bc5aceb083c Mon Sep 17 00:00:00 2001 From: fubar2 Date: Thu, 21 Sep 2023 15:48:21 +1000 Subject: [PATCH 17/21] renamed unit test back to unit_test.. but that stops it testing - needs to start with test for tox to run automagically it seems. Reverted the sample --- test/import_xml.xml | 5 ++--- test/{test_import.py => unit_test_import_xml.py} | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) rename test/{test_import.py => unit_test_import_xml.py} (99%) diff --git a/test/import_xml.xml b/test/import_xml.xml index b4eca22..132118e 100644 --- a/test/import_xml.xml +++ b/test/import_xml.xml @@ -1,5 +1,5 @@ - + description operation_0004 @@ -18,8 +18,7 @@ v_command - - + diff --git a/test/test_import.py b/test/unit_test_import_xml.py similarity index 99% rename from test/test_import.py rename to test/unit_test_import_xml.py index 90f4c0f..f381076 100644 --- a/test/test_import.py +++ b/test/unit_test_import_xml.py @@ -26,7 +26,6 @@ def test_override(self): exml = self.tool.export() self.assertEqual(self.tool.command_override, col) exml = exml.replace("\n", " ") - print("-----------exml", exml) self.assertTrue(co in exml) class TestCommand(TestImport): From 3cd2c2288044caa41bb8e1102df41f4ccf6334ef Mon Sep 17 00:00:00 2001 From: fubar2 Date: Thu, 21 Sep 2023 15:50:19 +1000 Subject: [PATCH 18/21] reformat --- test/unit_test_import_xml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit_test_import_xml.py b/test/unit_test_import_xml.py index f381076..bf944b6 100644 --- a/test/unit_test_import_xml.py +++ b/test/unit_test_import_xml.py @@ -33,7 +33,7 @@ def test_command(self): try: de = self.tool.command.node.attrib["detect_errors"] except KeyError: - de = None + de = None self.assertEqual(de, None) ctext = self.tool.command.node.text self.assertEqual(ctext.strip(), "command") From 224de6fe666fbd673d93cdf60f22377a461a80af Mon Sep 17 00:00:00 2001 From: fubar2 Date: Thu, 21 Sep 2023 17:42:39 +1000 Subject: [PATCH 19/21] mostly my own flake things --- galaxyxml/tool/__init__.py | 2 -- galaxyxml/tool/import_xml.py | 3 +-- galaxyxml/tool/parameters/__init__.py | 6 ++---- test/unit_test_import_xml.py | 3 +++ 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/galaxyxml/tool/__init__.py b/galaxyxml/tool/__init__.py index c6f8329..12c9083 100644 --- a/galaxyxml/tool/__init__.py +++ b/galaxyxml/tool/__init__.py @@ -89,7 +89,6 @@ def append_version_command(self): except Exception: pass - def append(self, sub_node): if issubclass(type(sub_node), XMLParam): self.root.append(sub_node.node) @@ -171,7 +170,6 @@ def export(self, keep_old_command=False): ) command_node_text = actual_cli.strip() export_xml.command_line = command_node_text - command_kwargs = {} try: command_element = export_xml.command except Exception: diff --git a/galaxyxml/tool/import_xml.py b/galaxyxml/tool/import_xml.py index faec884..805c0f2 100644 --- a/galaxyxml/tool/import_xml.py +++ b/galaxyxml/tool/import_xml.py @@ -92,13 +92,12 @@ def _load_command(self, tool, command_root): except KeyError: detect_errors = None ctext = command_root.text - command = gxtp.Command(detect_errors = detect_errors) + command = gxtp.Command(detect_errors=detect_errors) command.node.text = ctext tool.command_line = ctext tool.command = command tool.executable = ctext.split()[0] - def _load_help(self, tool, help_root): """ Load the content of the into the tool. diff --git a/galaxyxml/tool/parameters/__init__.py b/galaxyxml/tool/parameters/__init__.py index c9ab8b7..d1bd0d4 100644 --- a/galaxyxml/tool/parameters/__init__.py +++ b/galaxyxml/tool/parameters/__init__.py @@ -1,8 +1,5 @@ import logging -from builtins import ( - object, - str -) +from builtins import (object, str) from galaxy.tool_util.parser.util import _parse_name from galaxyxml import Util @@ -77,6 +74,7 @@ def command_line(self, mako_path=None): """ return None + class Command(XMLParam): name = "command" diff --git a/test/unit_test_import_xml.py b/test/unit_test_import_xml.py index bf944b6..2ed7906 100644 --- a/test/unit_test_import_xml.py +++ b/test/unit_test_import_xml.py @@ -12,6 +12,7 @@ def setUp(self): gxp = GalaxyXmlParser() self.tool = gxp.import_xml("test/import_xml.xml") + class TestStdios(TestImport): def test_stdio(self): std = self.tool.stdios.children[0].node @@ -28,6 +29,7 @@ def test_override(self): exml = exml.replace("\n", " ") self.assertTrue(co in exml) + class TestCommand(TestImport): def test_command(self): try: @@ -38,6 +40,7 @@ def test_command(self): ctext = self.tool.command.node.text self.assertEqual(ctext.strip(), "command") + class TestImportXml(TestImport): def test_init_tool(self): xml_root = self.tool.root From a9dcc205db80b52b300f882de55efc79e354b58a Mon Sep 17 00:00:00 2001 From: Helena Rasche Date: Fri, 22 Sep 2023 09:18:09 +0200 Subject: [PATCH 20/21] remove stdio from ref --- examples/tool.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/examples/tool.xml b/examples/tool.xml index 2347717..9e11993 100644 --- a/examples/tool.xml +++ b/examples/tool.xml @@ -5,10 +5,6 @@ samtools one_super_image - - - - Date: Fri, 22 Sep 2023 09:22:28 +0200 Subject: [PATCH 21/21] whatever --- galaxyxml/tool/parameters/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galaxyxml/tool/parameters/__init__.py b/galaxyxml/tool/parameters/__init__.py index d1bd0d4..04c0b53 100644 --- a/galaxyxml/tool/parameters/__init__.py +++ b/galaxyxml/tool/parameters/__init__.py @@ -1,5 +1,5 @@ import logging -from builtins import (object, str) +from builtins import (object, str) from galaxy.tool_util.parser.util import _parse_name from galaxyxml import Util