diff --git a/planemo/galaxy/activity.py b/planemo/galaxy/activity.py index 867b23120..de382a875 100644 --- a/planemo/galaxy/activity.py +++ b/planemo/galaxy/activity.py @@ -503,7 +503,7 @@ def outputs_dict(self): def download_output_to(self, ctx, dataset_details, output_directory, filename=None): if filename is None: - local_filename = sanitize_filename(dataset_details.get("cwl_file_name") or dataset_details.get("name")) + local_filename = f'{sanitize_filename(dataset_details.get("cwl_file_name") or dataset_details.get("name"))}__{dataset_details["uuid"]}' else: local_filename = filename destination = os.path.join(output_directory, local_filename) diff --git a/tests/data/wf_same_name_outputs-tests.yml b/tests/data/wf_same_name_outputs-tests.yml new file mode 100644 index 000000000..201b462f9 --- /dev/null +++ b/tests/data/wf_same_name_outputs-tests.yml @@ -0,0 +1,17 @@ +- doc: Test outline for Test-workflow + job: + input text file with numbers: + class: File + path: wf_same_name_outputs_input.txt + filetype: txt + outputs: + output: + element_tests: + split_file_000000.txt: + asserts: + has_n_lines: + n: 1 + split_file_000001.txt: + asserts: + has_n_lines: + n: 2 diff --git a/tests/data/wf_same_name_outputs.ga b/tests/data/wf_same_name_outputs.ga new file mode 100644 index 000000000..37418f117 --- /dev/null +++ b/tests/data/wf_same_name_outputs.ga @@ -0,0 +1,167 @@ +{ + "a_galaxy_workflow": "true", + "annotation": "Workflow with multiple output with identical names", + "format-version": "0.1", + "name": "Test workflow", + "steps": { + "0": { + "annotation": "input text file with numbers, one per line", + "content_id": null, + "errors": null, + "id": 0, + "input_connections": {}, + "inputs": [ + { + "description": "input text file with numbers, one per line", + "name": "input text file with numbers" + } + ], + "label": "input text file with numbers", + "name": "Input dataset", + "outputs": [], + "position": { + "left": 0, + "top": 46 + }, + "tool_id": null, + "tool_state": "{\"optional\": false, \"tag\": null}", + "tool_version": null, + "type": "data_input", + "uuid": "a659f5f4-cde9-46d5-8b9b-4dec7be29393", + "when": null, + "workflow_outputs": [] + }, + "1": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/bgruening/split_file_to_collection/split_file_to_collection/0.5.0", + "errors": null, + "id": 1, + "input_connections": { + "split_parms|input": { + "id": 0, + "output_name": "output" + } + }, + "inputs": [], + "label": null, + "name": "Split file", + "outputs": [ + { + "name": "list_output_txt", + "type": "input" + } + ], + "position": { + "left": 280, + "top": 30 + }, + "post_job_actions": { + "HideDatasetActionlist_output_txt": { + "action_arguments": {}, + "action_type": "HideDatasetAction", + "output_name": "list_output_txt" + } + }, + "tool_id": "toolshed.g2.bx.psu.edu/repos/bgruening/split_file_to_collection/split_file_to_collection/0.5.0", + "tool_shed_repository": { + "changeset_revision": "6cbe2f30c2d7", + "name": "split_file_to_collection", + "owner": "bgruening", + "tool_shed": "toolshed.g2.bx.psu.edu" + }, + "tool_state": "{\"split_parms\": {\"select_ftype\": \"txt\", \"__current_case__\": 5, \"input\": {\"__class__\": \"ConnectedValue\"}, \"select_mode\": {\"mode\": \"chunk\", \"__current_case__\": 0, \"chunksize\": \"1\"}, \"newfilenames\": \"split_file\", \"select_allocate\": {\"allocate\": \"byrow\", \"__current_case__\": 2}}, \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "0.5.0", + "type": "tool", + "uuid": "b0485dad-0939-489d-8a9d-877d847dc29f", + "when": null, + "workflow_outputs": [] + }, + "2": { + "annotation": "", + "content_id": "param_value_from_file", + "errors": null, + "id": 2, + "input_connections": { + "input1": { + "id": 1, + "output_name": "list_output_txt" + } + }, + "inputs": [], + "label": null, + "name": "Parse parameter value", + "outputs": [ + { + "name": "integer_param", + "type": "expression.json" + } + ], + "position": { + "left": 560, + "top": 0 + }, + "post_job_actions": { + "HideDatasetActiontext_param": { + "action_arguments": {}, + "action_type": "HideDatasetAction", + "output_name": "text_param" + } + }, + "tool_id": "param_value_from_file", + "tool_state": "{\"input1\": {\"__class__\": \"ConnectedValue\"}, \"param_type\": \"integer\", \"remove_newlines\": true, \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "0.1.0", + "type": "tool", + "uuid": "7a0d475f-e575-4a37-a2e8-5f5756694b39", + "when": null, + "workflow_outputs": [] + }, + "3": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/bgruening/text_processing/tp_text_file_with_recurring_lines/1.1.0", + "errors": null, + "id": 3, + "input_connections": { + "token_set_0|repeat_select|times": { + "id": 2, + "output_name": "integer_param" + } + }, + "inputs": [], + "label": null, + "name": "Create text file", + "outputs": [ + { + "name": "outfile", + "type": "txt" + } + ], + "position": { + "left": 840, + "top": 42 + }, + "post_job_actions": {}, + "tool_id": "toolshed.g2.bx.psu.edu/repos/bgruening/text_processing/tp_text_file_with_recurring_lines/1.1.0", + "tool_shed_repository": { + "changeset_revision": "ddf54b12c295", + "name": "text_processing", + "owner": "bgruening", + "tool_shed": "toolshed.g2.bx.psu.edu" + }, + "tool_state": "{\"token_set\": [{\"__index__\": 0, \"line\": \"test\", \"repeat_select\": {\"repeat_select_opts\": \"user\", \"__current_case__\": 0, \"times\": {\"__class__\": \"ConnectedValue\"}}}], \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "1.1.0", + "type": "tool", + "uuid": "5be7215e-3c3d-4302-91dd-e5f020a2c16b", + "when": null, + "workflow_outputs": [ + { + "label": "output", + "output_name": "outfile", + "uuid": "8b281401-fe43-4fd0-b835-532c3bba1b98" + } + ] + } + }, + "tags": [], + "uuid": "3d858ad4-cd53-468c-8e51-860b31356343", + "version": 3 +} \ No newline at end of file diff --git a/tests/data/wf_same_name_outputs_input.txt b/tests/data/wf_same_name_outputs_input.txt new file mode 100644 index 000000000..1191247b6 --- /dev/null +++ b/tests/data/wf_same_name_outputs_input.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/tests/test_cmd_test.py b/tests/test_cmd_test.py index cc256c852..e02658514 100644 --- a/tests/test_cmd_test.py +++ b/tests/test_cmd_test.py @@ -368,3 +368,12 @@ def test_workflow_test_skipped_invocation(self): test_command = self.append_profile_argument_if_needed(test_command) test_command.append(test_artifact) self._check_exit_code(test_command, exit_code=0) + + @skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS") + def test_workflow_with_identical_output_names(self): + with self._isolate(): + test_artifact = os.path.join(TEST_DATA_DIR, "wf_same_name_outputs.ga") + test_command = self._test_command() + test_command = self.append_profile_argument_if_needed(test_command) + test_command.append(test_artifact) + self._check_exit_code(test_command, exit_code=0)