diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml
new file mode 100644
index 00000000..ac32e90a
--- /dev/null
+++ b/.github/workflows/pr.yaml
@@ -0,0 +1,62 @@
+name: Test Pull Request
+
+on: [pull_request]
+
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ python-version: ['3.8']
+ steps:
+ - uses: actions/checkout@v1
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Cache .cache/pip
+ uses: actions/cache@v3
+ id: cache-pip
+ with:
+ path: ~/.cache/pip
+ key: pip_cache_py_${{ matrix.python-version }}
+ - name: Install package
+ run: |
+ touch requirements.txt
+ pip install -r requirements.txt black==23.3 flake8==6.0
+ - name: Flake8
+ run: flake8 --ignore=C901,W503,E501
+ # at the moment I would prefer not to enable this
+ # - name: Black
+ # uses: psf/black@23.3.0
+
+ test:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ python-version: ['3.8']
+ steps:
+ - uses: actions/checkout@v1
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Cache .cache/pip
+ uses: actions/cache@v3
+ id: cache-pip
+ with:
+ path: ~/.cache/pip
+ key: pip_cache_py_${{ matrix.python-version }}
+ - name: setup
+ run: |
+ pip install -r requirements.txt .
+ pip install -r requirements-dev.txt
+ #TODO reenable: works only on branch?
+ # - name: diff_pydocstyle_report
+ # run: make diff_pydocstyle_report
+ - name: Test
+ run: make test
+ - name: Planemo lint tools
+ run: planemo l tests/test-data/
+ # planemo test content of tests/test-data (this is OK, because the previous
+ # tests ensure equality of the xmls that are generated and those in the package)
+ - name: planemo test tools
+ run: export PATH=$(pwd)/tests/test-data:$PATH && planemo t tests/test-data/
\ No newline at end of file
diff --git a/ctdconverter/galaxy/converter.py b/ctdconverter/galaxy/converter.py
index d0744000..e30023f4 100755
--- a/ctdconverter/galaxy/converter.py
+++ b/ctdconverter/galaxy/converter.py
@@ -1160,24 +1160,23 @@ def create_param_attribute_list(param_node, param, model, supported_file_formats
# parameters need to be treated in cheetah. variable names are currently fixed back
# to dashes in fill_ctd.py. currently there seems to be only a single tool
# requiring this https://github.com/OpenMS/OpenMS/pull/4529
- param_node.attrib["name"] = get_galaxy_parameter_name(param)
- param_node.attrib["argument"] = "-%s" % utils.extract_param_name(param)
+ argument = "-%s" % utils.extract_param_name(param)
+ name = get_galaxy_parameter_name(param)
+ if argument.lstrip("-").replace("-", "_") != name:
+ param_node.attrib["name"] = get_galaxy_parameter_name(param)
+ param_node.attrib["argument"] = argument
+
param_type = TYPE_TO_GALAXY_TYPE[param.type]
if param_type is None:
raise ModelError("Unrecognized parameter type %(type)s for parameter %(name)s"
% {"type": param.type, "name": param.name})
+
# ITEMLIST is rendered as text field (even if its integers or floats), an
- # exception is files which are treated a bit below
+ # exception is files which are treated just below
if param.is_list:
param_type = "text"
-
if is_selection_parameter(param):
param_type = "select"
- if len(param.restrictions.choices) < 5:
- param_node.attrib["display"] = "checkboxes"
- if param.is_list:
- param_node.attrib["multiple"] = "true"
-
if is_boolean_parameter(param):
param_type = "boolean"
@@ -1204,10 +1203,20 @@ def create_param_attribute_list(param_node, param, model, supported_file_formats
# (in Galaxy the default would be prefilled in the form and at least
# one option needs to be selected).
if not (param.default is None or type(param.default) is _Null) and param_node.attrib["type"] in ["integer", "float", "text", "boolean", "select"]:
- logger.error("%s %s %s %s %s" % (param.name, param.default is None, type(param.default) is _Null, param_type, param.type))
- param_node.attrib["optional"] = "false"
+ # logger.error("%s %s %s %s %s" % (param.name, param.default is None, type(param.default) is _Null, param_type, param.type))
+ optional = False
else:
- param_node.attrib["optional"] = str(not param.required).lower()
+ optional = not param.required
+ param_node.attrib["optional"] = str(optional).lower()
+
+ if is_selection_parameter(param):
+ if param.is_list:
+ param_node.attrib["multiple"] = "true"
+ if len(param.restrictions.choices) < 5:
+ if param.is_list and optional:
+ param_node.attrib["display"] = "checkboxes"
+ elif not param.is_list and not optional:
+ param_node.attrib["display"] = "radio"
# check for parameters with restricted values (which will correspond to a "select" in galaxy)
if param.restrictions is not None or param_type == "boolean":
@@ -1482,7 +1491,7 @@ def create_boolean_parameter(param_node, param):
def all_outputs(model, parameter_hardcoder):
"""
- return lists of reqired and optional output parameters
+ return lists of required and optional output parameters
"""
out = []
optout = []
@@ -1673,6 +1682,15 @@ def create_tests(parent, inputs=None, outputs=None, test_macros_prefix=None, nam
test_node = add_child_node(tests_node, "test")
strip_elements(inputs, "validator", "sanitizer")
for node in inputs.iter():
+ # params do not have a name if redundant with argument
+ # -> readd and restore attrib order
+ if node.tag == "param" and not node.attrib.get("name") and node.attrib.get("argument"):
+ attrib = copy.deepcopy(node.attrib)
+ node.attrib["name"] = node.attrib["argument"].lstrip("-").replace("-", "_")
+ for a in attrib:
+ del node.attrib[a]
+ node.attrib[a] = attrib[a]
+
if node.tag == "expand" and node.attrib["macro"] == ADVANCED_OPTIONS_NAME + "macro":
node.tag = "conditional"
node.attrib["name"] = ADVANCED_OPTIONS_NAME + "cond"
@@ -1742,9 +1760,10 @@ def create_tests(parent, inputs=None, outputs=None, test_macros_prefix=None, nam
node.attrib["value"] = "outfile.txt"
if node.tag == "collection":
node.tag = "output_collection"
+ node.attrib["count"] = "0" # add a mock count element
if node.attrib.get("name", None) == "stdout":
node.attrib["lines_diff"] = "2"
- for a in set(node.attrib) - {"name", "value", "ftype", "lines_diff"}:
+ for a in set(node.attrib) - {"name", "value", "ftype", "lines_diff", "count"}:
del node.attrib[a]
strip_elements(outputs, "delete_node", "discover_datasets", "filter", "change_format")
diff --git a/requirements-dev.txt b/requirements-dev.txt
new file mode 100644
index 00000000..c8bbc23f
--- /dev/null
+++ b/requirements-dev.txt
@@ -0,0 +1,3 @@
+diff_cover
+planemo
+pydocstyle
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 00000000..9efeead0
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,3 @@
+git+https://github.com/WorkflowConversion/CTDopts
+lxml
+ruamel.yaml
\ No newline at end of file
diff --git a/tests/test-data/bool.xml b/tests/test-data/bool.xml
index 89f1ed08..ea96da1b 100644
--- a/tests/test-data/bool.xml
+++ b/tests/test-data/bool.xml
@@ -32,12 +32,12 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
-
-
-
-
-
+
+
+
+
+
+
@@ -49,10 +49,10 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
-
-
-
+
+
+
+
diff --git a/tests/test-data/float.xml b/tests/test-data/float.xml
index abfa3a2b..da0975d8 100644
--- a/tests/test-data/float.xml
+++ b/tests/test-data/float.xml
@@ -32,14 +32,14 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -59,14 +59,14 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/tests/test-data/ifile.xml b/tests/test-data/ifile.xml
index ec93a199..5f091a19 100644
--- a/tests/test-data/ifile.xml
+++ b/tests/test-data/ifile.xml
@@ -756,30 +756,30 @@ ${' '.join(["'test_section.sect_list_mandatory_multformat/%s/%s.%s'"%(i, re.sub(
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -831,30 +831,30 @@ ${' '.join(["'test_section.sect_list_mandatory_multformat/%s/%s.%s'"%(i, re.sub(
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/test-data/integer.xml b/tests/test-data/integer.xml
index 655678b9..45e6aa45 100644
--- a/tests/test-data/integer.xml
+++ b/tests/test-data/integer.xml
@@ -32,14 +32,14 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -59,14 +59,14 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/tests/test-data/label-help.xml b/tests/test-data/label-help.xml
index dae6c607..3eb8e4b2 100644
--- a/tests/test-data/label-help.xml
+++ b/tests/test-data/label-help.xml
@@ -32,28 +32,28 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/tests/test-data/ofile-corresponding-input.xml b/tests/test-data/ofile-corresponding-input.xml
index bb213ef6..885012ac 100644
--- a/tests/test-data/ofile-corresponding-input.xml
+++ b/tests/test-data/ofile-corresponding-input.xml
@@ -214,9 +214,9 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
-
-
+
+
+
diff --git a/tests/test-data/ofile-mult-typeparam.xml b/tests/test-data/ofile-mult-typeparam.xml
index 8f033925..e44b0f2b 100644
--- a/tests/test-data/ofile-mult-typeparam.xml
+++ b/tests/test-data/ofile-mult-typeparam.xml
@@ -51,14 +51,14 @@ ${' '.join(["&& mv -n 'test_section_sect_mandatory_mandatoryinput/%(bn)s/%(id)s.
-
+
-
+
-
+
@@ -93,8 +93,8 @@ ${' '.join(["&& mv -n 'test_section_sect_mandatory_mandatoryinput/%(bn)s/%(id)s.
-
-
+
+
-
-
+
+
@@ -87,7 +87,7 @@ ${' '.join(["&& mv -n 'mandatory_mandatoryinput/%(bn)s/%(id)s.%(gext)s' 'mandato
-
+
-
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -251,25 +251,25 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
-
+
-
+
-
+
diff --git a/tests/test-data/repeat_test.xml b/tests/test-data/repeat_test.xml
index 4970fe56..ae9ac37d 100644
--- a/tests/test-data/repeat_test.xml
+++ b/tests/test-data/repeat_test.xml
@@ -32,89 +32,89 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -299,89 +299,89 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/tests/test-data/select_test.xml b/tests/test-data/select_test.xml
index 02429e2c..6f6baa74 100644
--- a/tests/test-data/select_test.xml
+++ b/tests/test-data/select_test.xml
@@ -32,35 +32,35 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
-
+
-
+
-
+
-
+
@@ -68,7 +68,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
@@ -76,7 +76,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
@@ -84,7 +84,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
@@ -92,35 +92,35 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
-
+
-
+
-
+
-
+
@@ -128,7 +128,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
@@ -136,7 +136,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
@@ -144,7 +144,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
@@ -153,28 +153,28 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
-
+
-
+
-
+
@@ -213,35 +213,35 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
-
+
-
+
-
+
-
+
@@ -249,7 +249,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
@@ -257,7 +257,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
@@ -265,7 +265,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
@@ -273,28 +273,28 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
-
+
-
+
-
+
@@ -333,35 +333,35 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
-
+
-
+
-
+
-
+
@@ -369,7 +369,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
@@ -377,7 +377,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
@@ -385,7 +385,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
@@ -395,35 +395,35 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
-
+
-
+
-
+
-
+
@@ -431,7 +431,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
@@ -439,7 +439,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
@@ -447,7 +447,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
@@ -455,35 +455,35 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
-
+
-
+
-
+
-
+
@@ -491,7 +491,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
@@ -499,7 +499,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
@@ -507,7 +507,7 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
diff --git a/tests/test-data/string.xml b/tests/test-data/string.xml
index eb1d1838..25b2883a 100644
--- a/tests/test-data/string.xml
+++ b/tests/test-data/string.xml
@@ -32,16 +32,16 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
-
+
-
+
-
+
@@ -71,16 +71,16 @@ python3 '$__tool_directory__/fill_ctd.py' '@EXECUTABLE@.ctd' '$args_json' '$hard
-
+
-
+
-
+
-
+