diff --git a/tests/fixtures/mapping-rules.yml b/tests/fixtures/mapping-rules.yml index 77b31ee..be5e53e 100644 --- a/tests/fixtures/mapping-rules.yml +++ b/tests/fixtures/mapping-rules.yml @@ -33,6 +33,11 @@ tools: - highmem - if: input_size >= 20 fail: Too much data, shouldn't run + toolshed.g2.bx.psu.edu/repos/iuc/bwameth/bwameth/.*: + rules: + - if: helpers.tool_version_gte(tool, '42') + env: + bwameth_is_great: yes users: fairycake@vortex.org: env: diff --git a/tests/test_shell.py b/tests/test_shell.py index 2ecbaed..d90c118 100644 --- a/tests/test_shell.py +++ b/tests/test_shell.py @@ -289,3 +289,14 @@ def test_dry_run_user_email(self): tpv_config) self.assertTrue("name: TEST_JOB_SLOTS_USER" in output, f"Expected 'name: TEST_JOB_SLOTS_USER' in destination\n{output}") + + def test_dry_run_tool_with_version(self): + job_config = os.path.join(os.path.dirname(__file__), 'fixtures/job_conf_dry_run.yml') + tpv_config = os.path.join(os.path.dirname(__file__), 'fixtures/mapping-rules.yml') + output = self.call_shell_command( + "tpv", "dry-run", "--job-conf", job_config, "--input-size", "6", "--user", "krikkitrobot@planetkrikkit.org", + "--tool", "toolshed.g2.bx.psu.edu/repos/iuc/bwameth/bwameth/42", + tpv_config) + self.assertTrue("bwameth_is_great" in output, + f"Expected 'bwameth_is_great' in destination\n{output}") + diff --git a/tpv/commands/dryrunner.py b/tpv/commands/dryrunner.py index deee0f3..111bf04 100644 --- a/tpv/commands/dryrunner.py +++ b/tpv/commands/dryrunner.py @@ -29,7 +29,10 @@ def from_params(job_conf, user=None, tool=None, tpv_confs=None, input_size=None) user = None if tool: - tool = mock_galaxy.Tool(tool) + tool = mock_galaxy.Tool( + tool, + version=tool.split('/')[-1] if '/' in tool else None + ) else: tool = None