diff --git a/lib/galaxy_test/api/test_tool_execute.py b/lib/galaxy_test/api/test_tool_execute.py new file mode 100644 index 000000000000..84f136317108 --- /dev/null +++ b/lib/galaxy_test/api/test_tool_execute.py @@ -0,0 +1,46 @@ +"""Test tool execution pieces. + +Longer term ideally we would separate all the tool tests in test_tools.py that +describe tool execution into this file and make sure we have parallel or matching +tests for both the legacy tool execution API and the tool request API. We would then +keep things like testing other tool APIs in ./test_tools.py (index, search, tool test +files, etc..). +""" + +from galaxy_test.base.decorators import requires_tool_id +from galaxy_test.base.populators import ( + DatasetPopulator, + TargetHistory, +) + + +@requires_tool_id("multi_data_param") +def test_multidata_param(target_history: TargetHistory): + hda1 = target_history.with_dataset("1\t2\t3").src_dict + hda2 = target_history.with_dataset("4\t5\t6").src_dict + execution = target_history.execute("multi_data_param").with_inputs( + { + "f1": {"batch": False, "values": [hda1, hda2]}, + "f2": {"batch": False, "values": [hda2, hda1]}, + } + ) + execution.assert_has_job(0).with_output("out1").with_contents("1\t2\t3\n4\t5\t6\n") + execution.assert_has_job(0).with_output("out2").with_contents("4\t5\t6\n1\t2\t3\n") + + +@requires_tool_id("expression_forty_two") +def test_galaxy_expression_tool_simplest(target_history: TargetHistory): + target_history.execute("expression_forty_two").assert_has_single_job.with_single_output.with_contents("42") + + +@requires_tool_id("expression_forty_two") +def test_galaxy_expression_tool_simple(target_history: TargetHistory): + execution = target_history.execute("expression_parse_int").with_inputs({"input1": "7"}) + execution.assert_has_single_job.with_single_output.with_contents("7") + + +@requires_tool_id("expression_log_line_count") +def test_galaxy_expression_metadata(target_history: TargetHistory): + hda1 = target_history.with_dataset("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14").src_dict + execution = target_history.execute("expression_log_line_count").with_inputs({"input1": hda1}) + execution.assert_has_single_job.with_single_output.with_contents("3") diff --git a/lib/galaxy_test/api/test_tools.py b/lib/galaxy_test/api/test_tools.py index acc7ff265669..ae427cc9fede 100644 --- a/lib/galaxy_test/api/test_tools.py +++ b/lib/galaxy_test/api/test_tools.py @@ -1225,23 +1225,6 @@ def test_library_data_param(self): output_multiple_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=output[1]) assert output_multiple_content == "TestData\nTestData\n", output_multiple_content - @skip_without_tool("multi_data_param") - def test_multidata_param(self): - with self.dataset_populator.test_history(require_new=False) as history_id: - hda1 = dataset_to_param(self.dataset_populator.new_dataset(history_id, content="1\t2\t3")) - hda2 = dataset_to_param(self.dataset_populator.new_dataset(history_id, content="4\t5\t6")) - inputs = { - "f1": {"batch": False, "values": [hda1, hda2]}, - "f2": {"batch": False, "values": [hda2, hda1]}, - } - response = self._run("multi_data_param", history_id, inputs, assert_ok=True) - output1 = response["outputs"][0] - output2 = response["outputs"][1] - output1_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=output1) - output2_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=output2) - assert output1_content == "1\t2\t3\n4\t5\t6\n", output1_content - assert output2_content == "4\t5\t6\n1\t2\t3\n", output2_content - @skip_without_tool("cat1") def test_run_cat1(self): with self.dataset_populator.test_history(require_new=False) as history_id: @@ -3050,42 +3033,6 @@ def test_group_tag_selection_multiple(self, history_id): output_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=output) assert output_content.strip() == "123\n456\n456\n0ab" - @skip_without_tool("expression_forty_two") - def test_galaxy_expression_tool_simplest(self): - history_id = self.dataset_populator.new_history() - run_response = self._run("expression_forty_two", history_id) - self._assert_status_code_is(run_response, 200) - self.dataset_populator.wait_for_history(history_id, assert_ok=True) - output_content = self.dataset_populator.get_history_dataset_content(history_id) - assert output_content == "42" - - @skip_without_tool("expression_parse_int") - def test_galaxy_expression_tool_simple(self): - history_id = self.dataset_populator.new_history() - inputs = { - "input1": "7", - } - run_response = self._run("expression_parse_int", history_id, inputs) - self._assert_status_code_is(run_response, 200) - self.dataset_populator.wait_for_history(history_id, assert_ok=True) - output_content = self.dataset_populator.get_history_dataset_content(history_id) - assert output_content == "7" - - @skip_without_tool("expression_log_line_count") - def test_galaxy_expression_metadata(self): - history_id = self.dataset_populator.new_history() - new_dataset1 = self.dataset_populator.new_dataset( - history_id, content="1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14" - ) - inputs = { - "input1": dataset_to_param(new_dataset1), - } - run_response = self._run("expression_log_line_count", history_id, inputs) - self._assert_status_code_is(run_response, 200) - self.dataset_populator.wait_for_history(history_id, assert_ok=True) - output_content = self.dataset_populator.get_history_dataset_content(history_id) - assert output_content == "3" - @skip_without_tool("cat1") def test_run_deferred_dataset(self, history_id): details = self.dataset_populator.create_deferred_hda(