Skip to content

Commit 505ac8d

Browse files
committed
Migrate some tool-on-deferred tests to newer style execute tests.
1 parent 635e16f commit 505ac8d

File tree

3 files changed

+45
-32
lines changed

3 files changed

+45
-32
lines changed

lib/galaxy_test/api/test_tool_execute.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,3 +613,23 @@ def test_null_to_text_tool_with_validation(required_tool: RequiredTool, tool_inp
613613
required_tool.execute.with_inputs(tool_input_format.when.any({})).assert_fails()
614614
required_tool.execute.with_inputs(tool_input_format.when.any({"parameter": None})).assert_fails()
615615
required_tool.execute.with_inputs(tool_input_format.when.any({"parameter": ""})).assert_fails()
616+
617+
618+
@requires_tool_id("cat|cat1")
619+
def test_deferred_basic(required_tool: RequiredTool, target_history: TargetHistory):
620+
has_src_dict = target_history.with_deferred_dataset_for_test_file("1.bed", ext="bed")
621+
inputs = {
622+
"input1": has_src_dict.src_dict,
623+
}
624+
output = required_tool.execute.with_inputs(inputs).assert_has_single_job.with_single_output
625+
output.assert_contains("chr1 147962192 147962580 CCDS989.1_cds_0_0_chr1_147962193_r 0 -")
626+
627+
628+
@requires_tool_id("metadata_bam")
629+
def test_deferred_with_metadata_options_filter(required_tool: RequiredTool, target_history: TargetHistory):
630+
has_src_dict = target_history.with_deferred_dataset_for_test_file("1.bam", ext="bam")
631+
inputs = {
632+
"input_bam": has_src_dict.src_dict,
633+
"ref_names": "chrM",
634+
}
635+
required_tool.execute.with_inputs(inputs).assert_has_single_job.with_single_output.with_contents_stripped("chrM")

lib/galaxy_test/api/test_tools.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2826,38 +2826,6 @@ def test_group_tag_selection_multiple(self, history_id):
28262826
output_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=output)
28272827
assert output_content.strip() == "123\n456\n456\n0ab"
28282828

2829-
@skip_without_tool("cat1")
2830-
def test_run_deferred_dataset(self, history_id):
2831-
details = self.dataset_populator.create_deferred_hda(
2832-
history_id, "https://raw.githubusercontent.com/galaxyproject/galaxy/dev/test-data/1.bed", ext="bed"
2833-
)
2834-
inputs = {
2835-
"input1": dataset_to_param(details),
2836-
}
2837-
outputs = self._cat1_outputs(history_id, inputs=inputs)
2838-
output = outputs[0]
2839-
details = self.dataset_populator.get_history_dataset_details(
2840-
history_id, dataset=output, wait=True, assert_ok=True
2841-
)
2842-
assert details["state"] == "ok"
2843-
output_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=output)
2844-
assert output_content.startswith("chr1 147962192 147962580 CCDS989.1_cds_0_0_chr1_147962193_r 0 -")
2845-
2846-
@skip_without_tool("metadata_bam")
2847-
def test_run_deferred_dataset_with_metadata_options_filter(self, history_id):
2848-
details = self.dataset_populator.create_deferred_hda(
2849-
history_id, "https://raw.githubusercontent.com/galaxyproject/galaxy/dev/test-data/1.bam", ext="bam"
2850-
)
2851-
inputs = {"input_bam": dataset_to_param(details), "ref_names": "chrM"}
2852-
run_response = self.dataset_populator.run_tool(tool_id="metadata_bam", inputs=inputs, history_id=history_id)
2853-
output = run_response["outputs"][0]
2854-
output_details = self.dataset_populator.get_history_dataset_details(
2855-
history_id, dataset=output, wait=True, assert_ok=True
2856-
)
2857-
assert output_details["state"] == "ok"
2858-
output_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=output)
2859-
assert output_content.startswith("chrM")
2860-
28612829
@skip_without_tool("pileup")
28622830
def test_metadata_validator_on_deferred_input(self, history_id):
28632831
deferred_bam_details = self.dataset_populator.create_deferred_hda(

lib/galaxy_test/base/populators.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4137,6 +4137,31 @@ def with_dataset(
41374137
)
41384138
return HasSrcDict("hda", new_dataset)
41394139

4140+
def with_deferred_dataset(
4141+
self,
4142+
uri: str,
4143+
named: Optional[str] = None,
4144+
ext: Optional[str] = None,
4145+
) -> "HasSrcDict":
4146+
kwd = {}
4147+
if named is not None:
4148+
kwd["name"] = named
4149+
new_dataset = self._dataset_populator.create_deferred_hda(
4150+
history_id=self._history_id,
4151+
uri=uri,
4152+
ext=ext,
4153+
)
4154+
return HasSrcDict("hda", new_dataset)
4155+
4156+
def with_deferred_dataset_for_test_file(
4157+
self,
4158+
filename: str,
4159+
named: Optional[str] = None,
4160+
ext: Optional[str] = None,
4161+
) -> "HasSrcDict":
4162+
base64_url = self._dataset_populator.base64_url_for_test_file(filename)
4163+
return self.with_deferred_dataset(base64_url, named=named, ext=ext)
4164+
41404165
def with_unpaired(self) -> "HasSrcDict":
41414166
return self._fetch_response(
41424167
self._dataset_collection_populator.create_unpaired_in_history(self._history_id, wait=True)

0 commit comments

Comments
 (0)