From 2c121c01f7109eda54cf5b44e2db064007046899 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 11 Apr 2024 00:21:53 +0200 Subject: [PATCH] Add test for workflow update from mixed tool sheds --- .../wf_autoupdate_test_multiple_repos.ga | 93 +++++++++++++++++++ tests/test_cmd_autoupdate.py | 13 +++ 2 files changed, 106 insertions(+) create mode 100644 tests/data/wf_repos/autoupdate_tests/wf_autoupdate_test_multiple_repos.ga diff --git a/tests/data/wf_repos/autoupdate_tests/wf_autoupdate_test_multiple_repos.ga b/tests/data/wf_repos/autoupdate_tests/wf_autoupdate_test_multiple_repos.ga new file mode 100644 index 000000000..a6cc59cc5 --- /dev/null +++ b/tests/data/wf_repos/autoupdate_tests/wf_autoupdate_test_multiple_repos.ga @@ -0,0 +1,93 @@ +{ + "steps": { + "0": { + "collection_type": "paired", + "type": "data_collection_input", + "label": "pe-fastq", + "id": 0, + "position": { + "left": 0, + "top": 0 + }, + "annotation": "", + "input_connections": {}, + "inputs": [ + { + "name": "pe-fastq", + "description": "" + } + ], + "tool_state": "{\"name\": \"pe-fastq\", \"collection_type\": \"paired\"}" + }, + "1": { + "label": "fastqc 1", + "tool_id": "toolshed.g2.bx.psu.edu/repos/bgruening/text_processing/tp_find_and_replace/9.3+galaxy0", + "tool_version": "9.3+galaxy0", + "tool_shed_repository": { + "name": "text_processing", + "owner": "bgruening", + "tool_shed": "toolshed.g2.bx.psu.edu", + "changeset_revision": "12615d397df7" + }, + "id": 1, + "position": { + "left": 10, + "top": 10 + }, + "type": "tool", + "name": "toolshed.g2.bx.psu.edu/repos/bgruening/text_processing/tp_find_and_replace/9.3+galaxy0", + "post_job_actions": {}, + "annotation": "", + "input_connections": { + "input_file": [ + { + "id": 0, + "output_name": "output" + } + ] + }, + "tool_state": "{\"__page__\": 0}", + "workflow_outputs": [ + { + "output_name": "text_file", + "label": "FastQC txt", + "uuid": null + } + ] + }, + "2": { + "label": "fastqc 2", + "tool_id": "testtoolshed.g2.bx.psu.edu/repos/devteam/fastqc/fastqc/0.69", + "tool_version": "0.69", + "tool_shed_repository": { + "name": "fastqc", + "owner": "devteam", + "tool_shed": "testtoolshed.g2.bx.psu.edu", + "changeset_revision": "7b0207bd2183" + }, + "id": 2, + "position": { + "left": 20, + "top": 20 + }, + "type": "tool", + "name": "testtoolshed.g2.bx.psu.edu/repos/devteam/fastqc/fastqc/0.69", + "post_job_actions": {}, + "annotation": "", + "input_connections": { + "input_file": [ + { + "id": 0, + "output_name": "output" + } + ] + }, + "tool_state": "{\"__page__\": 0}" + } + }, + "a_galaxy_workflow": "true", + "format-version": "0.1", + "name": "Workflow", + "uuid": "869b6bb3-23a8-4322-a325-cc55abdf7540", + "annotation": "Run fastqc" +} diff --git a/tests/test_cmd_autoupdate.py b/tests/test_cmd_autoupdate.py index da4a90dfb..0229d9784 100644 --- a/tests/test_cmd_autoupdate.py +++ b/tests/test_cmd_autoupdate.py @@ -115,6 +115,19 @@ def test_autoupdate_workflow(self): assert wf["steps"][1]["run"]["steps"][0]["tool_version"] == "3.7+galaxy0" assert wf["release"] == "0.1.1" + def test_autoupdate_workflow_from_multiple_tool_sheds(self): + with self._isolate_with_test_data("wf_repos/autoupdate_tests") as f: + wf_file = os.path.realpath(os.path.join(f, "wf_autoupdate_test_multiple_repos.ga")) + autoupdate_command = ["autoupdate", wf_file] + result = self._runner.invoke(self._cli.planemo, autoupdate_command) + assert f"Auto-updating workflow {wf_file}" in result.output + with open(wf_file) as g: + wf = json.load(g) + # Assert toolshed tool is updated + assert wf["steps"]["1"]["tool_version"] != "9.3+galaxy0" + # Assert testtoolshed tool is updated + assert wf["steps"]["2"]["tool_version"] != "0.69" + def test_autoupdate_workflow_unexisting_version(self): """Test autoupdate command for a workflow where the version of the tool is not in the toolshed.""" with self._isolate_with_test_data("wf_repos/autoupdate_tests") as f: