Get the needed ToolEvaluator.build return value by index

Co-authored-by: Nicola Soranzo <nicola.soranzo@gmail.com>
This commit is contained in:
Marius van den Beek
2022-02-08 21:35:13 +01:00
committed by GitHub
co-authored by Nicola Soranzo
parent 96e76c62d2
commit 7c4905251c
+11 -11
View File
@@ -53,7 +53,7 @@ class ToolEvaluatorTestCase(TestCase, UsesApp):
def test_simple_evaluation(self):
self._setup_test_bwa_job()
self._set_compute_environment()
command_line, version_command_line, extra_filenames, _ = self.evaluator.build()
command_line = self.evaluator.build()[0]
self.assertEqual(command_line, "bwa --thresh=4 --in=/galaxy/files/dataset_1.dat --out=/galaxy/files/dataset_2.dat")
def test_repeat_evaluation(self):
@@ -64,19 +64,19 @@ class ToolEvaluatorTestCase(TestCase, UsesApp):
self.job.parameters = [JobParameter(name="r", value='''[{"thresh": 4, "__index__": 0},{"thresh": 5, "__index__": 1}]''')]
self.tool._command_line = "prog1 #for $r_i in $r # $r_i.thresh#end for#"
self._set_compute_environment()
command_line, version_command_line, extra_filenames, _ = self.evaluator.build()
command_line = self.evaluator.build()[0]
self.assertEqual(command_line, "prog1 4 5")
def test_eval_galaxy_url(self):
self.tool._command_line = "prog1 $__galaxy_url__"
self._set_compute_environment()
command_line, version_command_line, extra_filenames, _ = self.evaluator.build()
command_line = self.evaluator.build()[0]
self.assertEqual(command_line, "prog1 %s" % TEST_GALAXY_URL)
def test_eval_history_id(self):
self.tool._command_line = "prog1 '$__history_id__'"
self._set_compute_environment()
command_line, version_command_line, extra_filenames, _ = self.evaluator.build()
command_line = self.evaluator.build()[0]
self.assertEqual(command_line, "prog1 '%s'" % self.app.security.encode_id(42))
def test_conditional_evaluation(self):
@@ -94,7 +94,7 @@ class ToolEvaluatorTestCase(TestCase, UsesApp):
self.job.parameters = [JobParameter(name="c", value='''{"thresh": 4, "always_true": "true", "__current_case__": 0}''')]
self.tool._command_line = "prog1 --thresh=${c.thresh} --test_param=${c.always_true}"
self._set_compute_environment()
command_line, version_command_line, extra_filenames, _ = self.evaluator.build()
command_line = self.evaluator.build()[0]
self.assertEqual(command_line, "prog1 --thresh=4 --test_param=true")
def test_evaluation_of_optional_datasets(self):
@@ -106,7 +106,7 @@ class ToolEvaluatorTestCase(TestCase, UsesApp):
self.tool.set_params({"input1": parameter})
self.tool._command_line = "prog1 --opt_input='${input1}'"
self._set_compute_environment()
command_line, version_command_line, extra_filenames, _ = self.evaluator.build()
command_line = self.evaluator.build()[0]
self.assertEqual(command_line, "prog1 --opt_input='None'")
def test_evaluation_with_path_rewrites_wrapped(self):
@@ -128,14 +128,14 @@ class ToolEvaluatorTestCase(TestCase, UsesApp):
input_paths=[DatasetPath(1, '/galaxy/files/dataset_1.dat', false_path=job_path_1)],
output_paths=[DatasetPath(2, '/galaxy/files/dataset_2.dat', false_path=job_path_2)],
)
command_line, version_command_line, extra_filenames, _ = self.evaluator.build()
command_line = self.evaluator.build()[0]
self.assertEqual(command_line, f"bwa --thresh=4 --in={job_path_1} --out={job_path_2}")
def test_configfiles_evaluation(self):
self.tool.config_files.append(("conf1", None, "$thresh"))
self.tool._command_line = "prog1 $conf1"
self._set_compute_environment()
command_line, version_command_line, extra_filenames, _ = self.evaluator.build()
command_line, _, extra_filenames, _ = self.evaluator.build()
self.assertEqual(len(extra_filenames), 1)
config_filename = extra_filenames[0]
config_basename = os.path.basename(config_filename)
@@ -175,14 +175,14 @@ class ToolEvaluatorTestCase(TestCase, UsesApp):
})
self.tool._command_line = "prog1 $index_path.fields.path"
self._set_compute_environment(unstructured_path_rewrites={"/old": "/new"})
command_line, version_command_line, extra_filenames, _ = self.evaluator.build()
command_line = self.evaluator.build()[0]
self.assertEqual(command_line, "prog1 /new/path/human")
def test_version_command(self):
self.tool.version_string_cmd = "echo v.1.1"
self._setup_test_bwa_job()
self._set_compute_environment()
command_line, version_command_line, extra_filenames, _ = self.evaluator.build()
version_command_line = self.evaluator.build()[1]
assert self.tool.version_string_cmd in version_command_line
def test_template_property_app(self):
@@ -201,7 +201,7 @@ class ToolEvaluatorTestCase(TestCase, UsesApp):
self.tool._command_line = "test.exe"
self.tool.config_files.append(("conf1", None, """%s""" % expression))
self._set_compute_environment()
_, _, extra_filenames, _ = self.evaluator.build()
extra_filenames = self.evaluator.build()[2]
config_filename = extra_filenames[0]
self.assertEqual(open(config_filename).read(), value)