Skip to content

Commit 3fc96b0

Browse files
committed
Add test
1 parent 3b89fff commit 3fc96b0

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

lib/galaxy_test/api/test_workflows.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5538,6 +5538,48 @@ def test_workflow_failed_with_message_exception(self, history_id):
55385538
assert message["workflow_step_id"] == 2
55395539
assert "Invalid new collection identifier" in message["details"]
55405540

5541+
@skip_without_tool("__RELABEL_FROM_FILE__")
5542+
def test_relabel_from_file_rejects_non_utf8_labels(self, history_id):
5543+
# Regression test: a UTF-16 (Windows-saved) labels file used to crash
5544+
# produce_outputs with UnicodeDecodeError. It should now fail with a
5545+
# clear MessageException instructing the user to re-save as UTF-8.
5546+
summary = self._run_workflow(
5547+
"""
5548+
class: GalaxyWorkflow
5549+
inputs:
5550+
input_collection:
5551+
collection_type: list
5552+
type: collection
5553+
relabel_file:
5554+
type: data
5555+
steps:
5556+
relabel:
5557+
tool_id: __RELABEL_FROM_FILE__
5558+
in:
5559+
input: input_collection
5560+
how|labels: relabel_file
5561+
test_data:
5562+
input_collection:
5563+
collection_type: list
5564+
elements:
5565+
- identifier: A
5566+
content: "alpha"
5567+
- identifier: B
5568+
content: "beta"
5569+
relabel_file:
5570+
value: relabel_utf16.tabular
5571+
type: File
5572+
""",
5573+
history_id=history_id,
5574+
assert_ok=False,
5575+
wait=True,
5576+
)
5577+
invocation_details = self.workflow_populator.get_invocation(summary.invocation_id, step_details=True)
5578+
assert invocation_details["state"] == "failed"
5579+
assert len(invocation_details["messages"]) == 1
5580+
message = invocation_details["messages"][0]
5581+
assert "UTF-8" in message["details"]
5582+
55415583
@skip_without_tool("__RELABEL_FROM_FILE__")
55425584
@skip_without_tool("job_properties")
55435585
@skip_without_tool("cat1")

test-data/relabel_utf16.tabular

66 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)