Skip to content

Commit

Permalink
Merge pull request #94 from cat-bro/fix-dry-run-tool-version
Browse files Browse the repository at this point in the history
Fix dry run tool version
  • Loading branch information
nuwang authored May 4, 2023
2 parents 053f106 + c2f28b9 commit d1ac1a9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tests/fixtures/mapping-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
[email protected]:
env:
Expand Down
11 changes: 11 additions & 0 deletions tests/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", "[email protected]",
"--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}")

5 changes: 4 additions & 1 deletion tpv/commands/dryrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d1ac1a9

Please sign in to comment.