Permalink
Browse files

Fix default behavior for ``planemo lint`` to use current directory.

Add tests to verify the default behavior when explicit paths are not supplied. Broken with 343902d.

Thanks to @nekrut for the bug report.
  • Loading branch information...
jmchilton committed May 12, 2015
1 parent ce51241 commit 1e3668afacf2f32287ae22b85999257c822239fa
Showing with 21 additions and 4 deletions.
  1. +11 −1 planemo/options.py
  2. +4 −3 tests/data/repos/single_tool/cat.xml
  3. +6 −0 tests/test_lint.py
@@ -1,5 +1,8 @@
""" Click definitions for various shared options and arguments.
"""

import os

import click
from galaxy.tools.deps import docker_util

@@ -142,6 +145,13 @@ def required_tool_arg():
return click.argument('path', metavar="TOOL_PATH", type=arg_type)


def _optional_tools_default(ctx, param, value):
if param.name == "paths" and len(value) == 0:
return [os.path.abspath(os.getcwd())]
else:
return value


def optional_tools_arg(multiple=False):
""" Decorate click method as optionally taking in the path to a tool
or directory of tools. If no such argument is given the current working
@@ -159,9 +169,9 @@ def optional_tools_arg(multiple=False):
return click.argument(
name,
metavar="TOOL_PATH",
default=".",
type=arg_type,
nargs=nargs,
callback=_optional_tools_default,
)


@@ -4,13 +4,13 @@
cat $input1 #for $q in $queries# ${q.input2} #end for# > $out_file1
</command>
<inputs>
<param name="input1" type="data" label="Concatenate Dataset"/>
<param name="input1" type="data" label="Concatenate Dataset" format="data" />
<repeat name="queries" title="Dataset">
<param name="input2" type="data" label="Select" />
<param name="input2" type="data" label="Select" format="data" />
</repeat>
</inputs>
<outputs>
<data name="out_file1" format="input" metadata_source="input1"/>
<data name="out_file1" format_source="input1" metadata_source="input1"/>
</outputs>
<tests>
<test>
@@ -19,5 +19,6 @@
</test>
</tests>
<help>
Concatenate datasets.
</help>
</tool>
@@ -22,6 +22,12 @@ def test_fail_tools(self):
lint_cmd = ["lint", fail_tool]
self._check_exit_code(lint_cmd, exit_code=1)

def test_lint_default(self):
with self._isolate_repo("single_tool"):
self._check_exit_code(["lint", "--skip", "citations"])
with self._isolate_repo("single_tool"):
self._check_exit_code(["lint"], exit_code=1)

def test_lint_multiple(self):
names = ["fail_citation.xml", "fail_order.xml"]
paths = list(map(lambda p: os.path.join(TEST_TOOLS_DIR, p), names))

0 comments on commit 1e3668a

Please sign in to comment.