From 685970820a1b7416d3d871dad620be055d46c059 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 16 Nov 2021 00:22:59 +0000 Subject: [PATCH] Fix API tests being skipped --- lib/galaxy/tool_util/cwl/parser.py | 1 - lib/galaxy_test/api/test_tools_cwl.py | 157 ++++++++++++++------------ lib/galaxy_test/base/populators.py | 1 + test/unit/tool_util/test_parsing.py | 2 +- 4 files changed, 85 insertions(+), 76 deletions(-) diff --git a/lib/galaxy/tool_util/cwl/parser.py b/lib/galaxy/tool_util/cwl/parser.py index 1914c2e63e61..320dc8a86280 100644 --- a/lib/galaxy/tool_util/cwl/parser.py +++ b/lib/galaxy/tool_util/cwl/parser.py @@ -294,7 +294,6 @@ def galaxy_id(self): # tool_id = os.path.splitext(os.path.basename(raw_id))[0] if not tool_id: return self._uuid - assert tool_id if tool_id.startswith("#"): tool_id = tool_id[1:] return tool_id diff --git a/lib/galaxy_test/api/test_tools_cwl.py b/lib/galaxy_test/api/test_tools_cwl.py index 3e411534fbb5..11cfc29acfc5 100644 --- a/lib/galaxy_test/api/test_tools_cwl.py +++ b/lib/galaxy_test/api/test_tools_cwl.py @@ -24,7 +24,8 @@ def setUp(self): worklfow_populator = WorkflowPopulator(self.galaxy_interactor) self.cwl_populator = CwlPopulator(self.dataset_populator, worklfow_populator) - @skip_without_tool("cat1-tool") + # FIXME: this tool is missing + @skip_without_tool("cat1-tool.cwl") def test_cat1_number(self): """Test execution of cat1 using the "normal" Galaxy job API representation.""" history_id = self.dataset_populator.new_history() @@ -40,10 +41,11 @@ def test_cat1_number(self): "file1": hda1, "numbering": {"src": "json", "value": True}, } - stdout = self._run_and_get_stdout("cat1-tool", history_id, inputs, assert_ok=True) + stdout = self._run_and_get_stdout("cat1-tool.cwl", history_id, inputs, assert_ok=True) self.assertEqual(stdout, " 1\t1\n 2\t2\n 3\t3\n") - @skip_without_tool("cat1-tool") + # FIXME: this tool is missing + @skip_without_tool("cat1-tool.cwl") def test_cat1_number_cwl_json(self): """Test execution of cat1 using the "CWL" Galaxy job API representation.""" history_id = self.dataset_populator.new_history() @@ -52,59 +54,63 @@ def test_cat1_number_cwl_json(self): "file1": hda1, "numbering": True, } - stdout = self._run_and_get_stdout("cat1-tool", history_id, inputs, assert_ok=True, inputs_representation="cwl") + stdout = self._run_and_get_stdout("cat1-tool.cwl", history_id, inputs, assert_ok=True, inputs_representation="cwl") self.assertEqual(stdout, " 1\t1\n 2\t2\n 3\t3\n") - @skip_without_tool("cat1-tool") + # FIXME: this tool is missing + @skip_without_tool("cat1-tool.cwl") def test_cat1_number_cwl_json_file(self): """Test execution of cat1 using the CWL job definition file.""" - run_object = self.cwl_populator.run_cwl_artifact("cat1-tool", "test/functional/tools/cwl_tools/v1.0/v1.0/cat-job.json") + run_object = self.cwl_populator.run_cwl_artifact("cat1-tool.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/cat-job.json") stdout = self._get_job_stdout(run_object.job_id) self.assertEqual(stdout, "Hello world!\n") - @skip_without_tool("cat1-tool") + # FIXME: this tool is missing + @skip_without_tool("cat1-tool.cwl") def test_cat1_number_cwl_n_json_file(self): - run_object = self.cwl_populator.run_cwl_artifact("cat1-tool", "test/functional/tools/cwl_tools/v1.0/v1.0/cat-n-job.json") + run_object = self.cwl_populator.run_cwl_artifact("cat1-tool.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/cat-n-job.json") stdout = self._get_job_stdout(run_object.job_id) self.assertEqual(stdout, " 1\tHello world!\n") - @skip_without_tool("cat2-tool") + # FIXME: this tool is missing + @skip_without_tool("cat2-tool.cwl") def test_cat2(self): - run_object = self.cwl_populator.run_cwl_artifact("cat2-tool", "test/functional/tools/cwl_tools/v1.0/v1.0/cat-job.json") + run_object = self.cwl_populator.run_cwl_artifact("cat2-tool.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/cat-job.json") stdout = self._get_job_stdout(run_object.job_id) self.assertEqual(stdout, "Hello world!\n") - @skip_without_tool("cat4-tool") + @skip_without_tool("cat4-tool.cwl") def test_cat4(self): - run_object = self.cwl_populator.run_cwl_artifact("cat4-tool", "test/functional/tools/cwl_tools/v1.0/v1.0/cat-job.json") + run_object = self.cwl_populator.run_cwl_artifact("cat4-tool.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/cat-job.json") output1_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) self.assertEqual(output1_content, "Hello world!\n") - @skip_without_tool("cat-default") + # FIXME: this tool is missing + @skip_without_tool("cat-default.cwl") def test_cat_default(self): - run_object = self.cwl_populator.run_cwl_artifact("cat-default", job={}) + run_object = self.cwl_populator.run_cwl_artifact("cat-default.cwl", job={}) output1_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) self.assertEqual(output1_content, "Hello world!\n") - @skip_without_tool("wc-tool") + @skip_without_tool("wc-tool.cwl") def test_wc(self): - run_object = self.cwl_populator.run_cwl_artifact("wc-tool", "test/functional/tools/cwl_tools/v1.0/v1.0/wc-job.json") + run_object = self.cwl_populator.run_cwl_artifact("wc-tool.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/wc-job.json") output1_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) if not IS_OS_X: self.assertEqual(output1_content, " 16 198 1111\n") else: self.assertEqual(output1_content, " 16 198 1111\n") - @skip_without_tool("wc2-tool") + @skip_without_tool("wc2-tool.cwl") def test_wc2(self): - run_object = self.cwl_populator.run_cwl_artifact("wc2-tool", "test/functional/tools/cwl_tools/v1.0/v1.0/wc-job.json") + run_object = self.cwl_populator.run_cwl_artifact("wc2-tool.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/wc-job.json") output1_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) self.assertEqual(output1_content, "16") - @skip_without_tool("wc3-tool") + @skip_without_tool("wc3-tool.cwl") def test_wc3(self): run_object = self.cwl_populator.run_cwl_artifact( - "wc4-tool", + "wc3-tool.cwl", job={ "file1": [ { @@ -118,13 +124,13 @@ def test_wc3(self): output1_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) self.assertEqual(output1_content, "16") - @skip_without_tool("wc4-tool") + @skip_without_tool("wc4-tool.cwl") def test_wc4(self): - run_object = self.cwl_populator.run_cwl_artifact("wc4-tool", "test/functional/tools/cwl_tools/v1.0/v1.0/wc-job.json") + run_object = self.cwl_populator.run_cwl_artifact("wc4-tool.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/wc-job.json") output1_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) self.assertEqual(output1_content, "16") - @skip_without_tool("galactic_cat") + @skip_without_tool("galactic_cat.cwl#galactic_cat") def test_galactic_cat_1(self): with self.dataset_populator.test_history() as history_id: hda_id = self.dataset_populator.new_dataset(history_id, name="test_dataset.txt")["id"] @@ -132,12 +138,12 @@ def test_galactic_cat_1(self): inputs = { "input1": {"src": "hda", "id": hda_id} } - run_response = self._run("galactic_cat", history_id, inputs, assert_ok=True) + run_response = self._run("galactic_cat.cwl#galactic_cat", history_id, inputs, assert_ok=True) dataset = run_response["outputs"][0] content = self.dataset_populator.get_history_dataset_content(history_id, dataset=dataset) assert content.strip() == "TestData123", content - @skip_without_tool("galactic_record_input") + @skip_without_tool("galactic_record_input.cwl#galactic_record_input") def test_galactic_record_input(self): with self.dataset_populator.test_history() as history_id: hda1_id = self.dataset_populator.new_dataset(history_id, content="moo", name="test_dataset.txt")["id"] @@ -147,7 +153,7 @@ def test_galactic_record_input(self): "input1": {"src": "hda", "id": hda1_id}, "input2": {"src": "hda", "id": hda2_id}, } - run_response = self._run("galactic_record_input", history_id, inputs, assert_ok=True) + run_response = self._run("galactic_record_input.cwl#galactic_record_input", history_id, inputs, assert_ok=True) dataset = run_response["outputs"][0] content = self.dataset_populator.get_history_dataset_content(history_id, dataset=dataset) assert content.strip() == "moo", content @@ -170,14 +176,14 @@ def _get_job_stdout(self, job_id): stdout = job_details.json()["stdout"] return stdout - @skip_without_tool("cat3-tool") + @skip_without_tool("cat3-tool.cwl") def test_cat3(self): with self.dataset_populator.test_history() as history_id: hda1 = _dataset_to_param(self.dataset_populator.new_dataset(history_id, content='1\t2\t3')) inputs = { "f1": hda1, } - response = self._run("cat3-tool", history_id, inputs, assert_ok=True) + response = self._run("cat3-tool.cwl", history_id, inputs, assert_ok=True) output1 = response["outputs"][0] output1_details = self.dataset_populator.get_history_dataset_details(history_id, dataset=output1) assert "created_from_basename" in output1_details, output1_details.keys() @@ -185,7 +191,7 @@ def test_cat3(self): output1_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=output1) assert output1_content == "1\t2\t3\n", output1_content - @skip_without_tool("sorttool") + @skip_without_tool("sorttool.cwl") def test_sorttool(self): history_id = self.dataset_populator.new_history() hda1 = _dataset_to_param(self.dataset_populator.new_dataset(history_id, content='1\n2\n3')) @@ -193,12 +199,12 @@ def test_sorttool(self): "reverse": False, "input": hda1 } - response = self._run("sorttool", history_id, inputs, assert_ok=True) + response = self._run("sorttool.cwl", history_id, inputs, assert_ok=True) output1 = response["outputs"][0] output1_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=output1) assert output1_content == "1\n2\n3\n", output1_content - @skip_without_tool("sorttool") + @skip_without_tool("sorttool.cwl") def test_sorttool_reverse(self): history_id = self.dataset_populator.new_history() hda1 = _dataset_to_param(self.dataset_populator.new_dataset(history_id, content='1\n2\n3')) @@ -206,37 +212,37 @@ def test_sorttool_reverse(self): "reverse": True, "input": hda1 } - response = self._run("sorttool", history_id, inputs, assert_ok=True) + response = self._run("sorttool.cwl", history_id, inputs, assert_ok=True) output1 = response["outputs"][0] output1_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=output1) assert output1_content == "3\n2\n1\n", output1_content - @skip_without_tool("env-tool1") + @skip_without_tool("env-tool1.cwl") def test_env_tool1(self): history_id = self.dataset_populator.new_history() inputs = { "in": "Hello World", } - response = self._run("env-tool1", history_id, inputs, assert_ok=True) + response = self._run("env-tool1.cwl", history_id, inputs, assert_ok=True) output1 = response["outputs"][0] output1_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=output1) self.assertEqual(output1_content, "Hello World\n") - @skip_without_tool("env-tool2") + @skip_without_tool("env-tool2.cwl") def test_env_tool2(self): - run_object = self.cwl_populator.run_cwl_artifact("env-tool2", "test/functional/tools/cwl_tools/v1.0/v1.0/env-job.json") + run_object = self.cwl_populator.run_cwl_artifact("env-tool2.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/env-job.json") output1_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) self.assertEqual(output1_content, "hello test env\n") - @skip_without_tool("rename") + @skip_without_tool("rename.cwl") def test_rename(self): - run_object = self.cwl_populator.run_cwl_artifact("rename", "test/functional/tools/cwl_tools/v1.0/v1.0/rename-job.json") + run_object = self.cwl_populator.run_cwl_artifact("rename.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/rename-job.json") output1_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) self.assertEqual(output1_content, whale_text()) - @skip_without_tool("optional-output") + @skip_without_tool("optional-output.cwl") def test_optional_output(self): - run_object = self.cwl_populator.run_cwl_artifact("optional-output", "test/functional/tools/cwl_tools/v1.0/v1.0/cat-job.json") + run_object = self.cwl_populator.run_cwl_artifact("optional-output.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/cat-job.json") output_file = run_object.output(0) optional_file = run_object.output(1) output_content = self.dataset_populator.get_history_dataset_content(run_object.history_id, dataset=output_file) @@ -244,10 +250,11 @@ def test_optional_output(self): self.assertEqual(output_content, "Hello world!\n") self.assertEqual(optional_content, "null") - @skip_without_tool("optional-output2") + # FIXME: this tool is missing + @skip_without_tool("optional-output2.cwl") def test_optional_output2_on(self): run_object = self.cwl_populator.run_cwl_artifact( - "optional-output2", + "optional-output2.cwl", job={ "produce": "do_write", }, @@ -256,10 +263,11 @@ def test_optional_output2_on(self): output_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) self.assertEqual(output_content, "bees\n") - @skip_without_tool("optional-output2") + # FIXME: this tool is missing + @skip_without_tool("optional-output2.cwl") def test_optional_output2_off(self): run_object = self.cwl_populator.run_cwl_artifact( - "optional-output2", + "optional-output2.cwl", job={ "produce": "dont_write", }, @@ -268,11 +276,12 @@ def test_optional_output2_off(self): output_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) self.assertEqual(output_content, "null") - @skip_without_tool("index1") - @skip_without_tool("showindex1") + # FIXME: these tools are missing + @skip_without_tool("index1.cwl") + @skip_without_tool("showindex1.cwl") def test_index1(self): run_object = self.cwl_populator.run_cwl_artifact( - "index1", + "index1.cwl", job={ "file": { "class": "File", @@ -283,7 +292,7 @@ def test_index1(self): ) output1 = self.dataset_populator.get_history_dataset_details(run_object.history_id) run_object = self.cwl_populator.run_cwl_artifact( - "showindex1", + "showindex1.cwl", job={ "file": { "src": "hda", @@ -296,30 +305,30 @@ def test_index1(self): output1_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) assert "call: 1\n" in output1_content, output1_content - @skip_without_tool("any1") + @skip_without_tool("any1.cwl") def test_any1_0(self): run_object = self.cwl_populator.run_cwl_artifact( - "any1", + "any1.cwl", job={"bar": 7}, test_data_directory="test/functional/tools/cwl_tools/v1.0/v1.0/", ) output1_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) assert output1_content == '7', output1_content - @skip_without_tool("any1") + @skip_without_tool("any1.cwl") def test_any1_1(self): run_object = self.cwl_populator.run_cwl_artifact( - "any1", + "any1.cwl", job={"bar": "7"}, test_data_directory="test/functional/tools/cwl_tools/v1.0/v1.0/", ) output1_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) assert output1_content == '"7"', output1_content - @skip_without_tool("any1") + @skip_without_tool("any1.cwl") def test_any1_file(self): run_object = self.cwl_populator.run_cwl_artifact( - "any1", + "any1.cwl", job={"bar": { "class": "File", "location": "whale.txt", @@ -330,72 +339,72 @@ def test_any1_file(self): self.dataset_populator._summarize_history(run_object.history_id) assert output1_content == '"File"', "[%s]" % output1_content - @skip_without_tool("any1") + @skip_without_tool("any1.cwl") def test_any1_2(self): run_object = self.cwl_populator.run_cwl_artifact( - "any1", + "any1.cwl", job={"bar": {"Cow": ["Turkey"]}}, test_data_directory="test/functional/tools/cwl_tools/v1.0/v1.0/", ) output1_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) assert output1_content == '{"Cow": ["Turkey"]}', output1_content - @skip_without_tool("null-expression1-tool") + @skip_without_tool("null-expression1-tool.cwl") def test_null_expression_1_1(self): - run_object = self.cwl_populator.run_cwl_artifact("null-expression1-tool", "test/functional/tools/cwl_tools/v1.0/v1.0/empty.json") + run_object = self.cwl_populator.run_cwl_artifact("null-expression1-tool.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/empty.json") output1_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) assert output1_content == '1', output1_content - @skip_without_tool("null-expression1-tool") + @skip_without_tool("null-expression1-tool.cwl") def test_null_expression_1_2(self): - run_object = self.cwl_populator.run_cwl_artifact("null-expression1-tool", "test/functional/tools/cwl_tools/v1.0/v1.0/null-expression2-job.json") + run_object = self.cwl_populator.run_cwl_artifact("null-expression1-tool.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/null-expression2-job.json") output1_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) assert output1_content == '2', output1_content - @skip_without_tool("null-expression2-tool") + @skip_without_tool("null-expression2-tool.cwl") def test_null_expression_any_bad_1(self): """Test explicitly passing null to Any type without a default value fails.""" - run_object = self.cwl_populator.run_cwl_artifact("null-expression2-tool", "test/functional/tools/cwl_tools/v1.0/v1.0/null-expression1-job.json", assert_ok=False) + run_object = self.cwl_populator.run_cwl_artifact("null-expression2-tool.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/null-expression1-job.json", assert_ok=False) self._assert_status_code_is(run_object.run_response, 400) - @skip_without_tool("null-expression2-tool") + @skip_without_tool("null-expression2-tool.cwl") def test_null_expression_any_bad_2(self): """Test Any without defaults can be unspecified.""" - run_object = self.cwl_populator.run_cwl_artifact("null-expression2-tool", "test/functional/tools/cwl_tools/v1.0/v1.0/empty.json", assert_ok=False) + run_object = self.cwl_populator.run_cwl_artifact("null-expression2-tool.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/empty.json", assert_ok=False) self._assert_status_code_is(run_object.run_response, 400) - @skip_without_tool("default_path") + @skip_without_tool("default_path.cwl") def test_default_path_override(self): - run_object = self.cwl_populator.run_cwl_artifact("default_path", "test/functional/tools/cwl_tools/v1.0/v1.0/default_path_job.yml") + run_object = self.cwl_populator.run_cwl_artifact("default_path.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/default_path_job.yml") output1_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) assert output1_content.strip() == "Hello world!", output1_content - @skip_without_tool("default_path_custom_1") + @skip_without_tool("default_path_custom_1.cwl") def test_default_path(self): # produces no output - just test the job runs okay. # later come back and verify standard output of the job. - run_object = self.cwl_populator.run_cwl_artifact("default_path_custom_1", job={}) + run_object = self.cwl_populator.run_cwl_artifact("default_path_custom_1.cwl", job={}) stdout = self._get_job_stdout(run_object.job_id) assert "this is the test file that will be used when calculating an md5sum" in stdout - @skip_without_tool("params") + @skip_without_tool("params.cwl") def test_params1(self): - run_object = self.cwl_populator.run_cwl_artifact("params", "test/functional/tools/cwl_tools/v1.0/v1.0/empty.json") + run_object = self.cwl_populator.run_cwl_artifact("params.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/empty.json") output1_content = self.dataset_populator.get_history_dataset_content(run_object.history_id) assert output1_content == '"b b"', output1_content - @skip_without_tool("parseInt-tool") + @skip_without_tool("parseInt-tool.cwl") def test_parse_int_tool(self): - run_object = self.cwl_populator.run_cwl_artifact("parseInt-tool", "test/functional/tools/cwl_tools/v1.0/v1.0/parseInt-job.json") + run_object = self.cwl_populator.run_cwl_artifact("parseInt-tool.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/parseInt-job.json") output1 = self.dataset_populator.get_history_dataset_details(run_object.history_id, hid=2) assert output1["state"] == "ok" output1_content = self.dataset_populator.get_history_dataset_content(run_object.history_id, hid=2) self.assertEqual(output1_content, '42') self.assertEqual(output1["extension"], "expression.json") - @skip_without_tool("record-output") + @skip_without_tool("record-output.cwl") def test_record_output(self): - run_object = self.cwl_populator.run_cwl_artifact("record-output", "test/functional/tools/cwl_tools/v1.0/v1.0/record-output-job.json") + run_object = self.cwl_populator.run_cwl_artifact("record-output.cwl", "test/functional/tools/cwl_tools/v1.0/v1.0/record-output-job.json") result_record = run_object.output_collection(0) assert result_record["collection_type"] == "record" record_elements = result_record["elements"] diff --git a/lib/galaxy_test/base/populators.py b/lib/galaxy_test/base/populators.py index 9ad5b74e55b7..eed70edf065e 100644 --- a/lib/galaxy_test/base/populators.py +++ b/lib/galaxy_test/base/populators.py @@ -385,6 +385,7 @@ def run_cwl_artifact( if datasets_uploaded: self.dataset_populator.wait_for_history(history_id=history_id, assert_ok=True) if tool_or_workflow == "tool": + galaxy_tool_id = tool_id tool_uuid = None if os.path.exists(tool_id): diff --git a/test/unit/tool_util/test_parsing.py b/test/unit/tool_util/test_parsing.py index fe2cbe5fc6eb..8b6912b2050d 100644 --- a/test/unit/tool_util/test_parsing.py +++ b/test/unit/tool_util/test_parsing.py @@ -556,7 +556,7 @@ def test_inputs_parsing(self): def test_id(self): tool_id = self._tool_source.parse_id() - assert tool_id == "galactic_record_input", tool_id + assert tool_id == "galactic_record_input.cwl#galactic_record_input", tool_id class DataSourceLoaderTestCase(BaseLoaderTestCase):