mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-01 15:37:32 +08:00
Use existing invalid test file, generalize error message
This commit is contained in:
@@ -4652,7 +4652,7 @@ class RelabelFromFileTool(DatabaseOperationTool):
|
||||
with open(new_labels_path) as fh:
|
||||
new_labels = fh.readlines(1024 * 1000000)
|
||||
except UnicodeDecodeError:
|
||||
raise exceptions.MessageException("Please re-save the file as UTF-8 and try again.")
|
||||
raise exceptions.MessageException("Please provide the file as valid UTF-8.")
|
||||
if strict and len(hdca.collection.elements) != len(new_labels):
|
||||
raise exceptions.MessageException("Relabel mapping file contains incorrect number of identifiers")
|
||||
if how_type in ["tabular", "tabular_extended"]:
|
||||
|
||||
@@ -5540,9 +5540,8 @@ test_data:
|
||||
|
||||
@skip_without_tool("__RELABEL_FROM_FILE__")
|
||||
def test_relabel_from_file_rejects_non_utf8_labels(self, history_id):
|
||||
# Regression test: a UTF-16 (Windows-saved) labels file used to crash
|
||||
# produce_outputs with UnicodeDecodeError. It should now fail with a
|
||||
# clear MessageException instructing the user to re-save as UTF-8.
|
||||
# Regression test: a non-UTF-8 labels file (for example UTF-16) should
|
||||
# fail with a clear MessageException rather than crash on decode.
|
||||
summary = self._run_workflow(
|
||||
"""
|
||||
class: GalaxyWorkflow
|
||||
@@ -5567,7 +5566,7 @@ test_data:
|
||||
- identifier: B
|
||||
content: "beta"
|
||||
relabel_file:
|
||||
value: relabel_utf16.tabular
|
||||
value: random-file
|
||||
type: File
|
||||
""",
|
||||
history_id=history_id,
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user