Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement tool testing for group_tag parameters. #18654

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/galaxy/tool_util/verify/interactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,14 @@ def stage_data_async(
tool_version: Optional[str] = None,
) -> Callable[[], None]:
fname = test_data["fname"]
tags = test_data.get("tags")
tool_input = {
"file_type": test_data["ftype"],
"dbkey": test_data["dbkey"],
}
if tags:
tool_input["tags"] = tags

metadata = test_data.get("metadata", {})
if not hasattr(metadata, "items"):
raise Exception(f"Invalid metadata description found for input [{fname}] - [{metadata}]")
Expand Down Expand Up @@ -1865,6 +1869,7 @@ def test_data_iter(required_files):
ftype=extra.get("ftype", DEFAULT_FTYPE),
dbkey=extra.get("dbkey", DEFAULT_DBKEY),
location=extra.get("location", None),
tags=extra.get("tags", []),
)
edit_attributes = extra.get("edit_attributes", [])

Expand Down
8 changes: 7 additions & 1 deletion lib/galaxy/tools/actions/upload_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,13 @@ def new_upload(
)
else:
upload_target_dataset_instance = __new_history_upload(trans, uploaded_dataset, history=history, state=state)

tags_raw = getattr(uploaded_dataset, "tags", None)
if tags_raw:
new_tags = tag_handler.parse_tags_list(tags_raw.split(","))
for tag in new_tags:
tag_handler.apply_item_tag(
user=trans.user, item=upload_target_dataset_instance, name=tag[0], value=tag[1], flush=True
)
if tag_list:
tag_handler.add_tags_from_list(trans.user, upload_target_dataset_instance, tag_list, flush=False)

Expand Down
27 changes: 27 additions & 0 deletions test/functional/tools/parameters/gx_group_tag.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<tool id="gx_group_tag" name="gx_group_tag" version="1.0.0">
<macros>
<import>macros.xml</import>
</macros>
<command><![CDATA[
echo "parameter: $parameter" > '$output'
]]></command>
<inputs>
<param name="ref_parameter" type="data_collection" format="tabular" />
<param name="parameter" type="group_tag" data_ref="ref_parameter" />
</inputs>
<expand macro="simple_text_output" />
<tests>
<test>
<param name="ref_parameter">
<collection type="paired">
<element name="forward" value="simple_line.txt" tags="group:type:single" />
<element name="reverse" value="simple_line_alternative.txt" tags="group:type:split" />
</collection>
</param>
<param name="parameter" value="type:single" />
<expand macro="assert_output">
<has_line line="parameter: type:single"/>
</expand>
</test>
</tests>
</tool>
1 change: 1 addition & 0 deletions tools/data_source/upload.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
</upload_dataset>
<param name="force_composite" type="hidden" value="false" />
<param name="dbkey" type="genomebuild" label="Genome" />
<param name="tags" type="hidden" value="" />
<conditional name="files_metadata" value_from="self:app.datatypes_registry.get_upload_metadata_params" value_ref="file_type" value_ref_in_group="False" />
<!-- <param name="other_dbkey" type="text" label="Or user-defined Genome" /> -->
</inputs>
Expand Down
Loading