From e8f3553404d4b348f58b3d839d97e0e32461f33c Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 28 Jul 2015 12:38:04 +0100 Subject: [PATCH] Fix expect_failure="true" failure semantics to cover tool submission failure. Previously it just covered runtime job failure - there should probably be a way for the tool developer to specify which sort of failure is expected. --- test/functional/test_toolbox.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/test/functional/test_toolbox.py b/test/functional/test_toolbox.py index 99d7c78d9f4..b3a43b9b390 100644 --- a/test/functional/test_toolbox.py +++ b/test/functional/test_toolbox.py @@ -44,6 +44,7 @@ class ToolTestCase( TwillTestCase ): job_stdio = None job_output_exceptions = None tool_execution_exception = None + expected_failure_occurred = False try: try: tool_response = galaxy_interactor.run_tool( testdef, test_history ) @@ -52,22 +53,26 @@ class ToolTestCase( TwillTestCase ): except RunToolException as e: tool_inputs = e.inputs tool_execution_exception = e - raise e + if not testdef.expect_failure: + raise e + else: + expected_failure_occurred = True except Exception as e: tool_execution_exception = e raise e - self.assertTrue( data_list or data_collection_list ) + if not expected_failure_occurred: + self.assertTrue( data_list or data_collection_list ) - try: - job_stdio = self._verify_outputs( testdef, test_history, jobs, shed_tool_id, data_list, data_collection_list, galaxy_interactor ) - except JobOutputsError as e: - job_stdio = e.job_stdio - job_output_exceptions = e.output_exceptions - raise e - except Exception as e: - job_output_exceptions = [e] - raise e + try: + job_stdio = self._verify_outputs( testdef, test_history, jobs, shed_tool_id, data_list, data_collection_list, galaxy_interactor ) + except JobOutputsError as e: + job_stdio = e.job_stdio + job_output_exceptions = e.output_exceptions + raise e + except Exception as e: + job_output_exceptions = [e] + raise e finally: job_data = {} if tool_inputs is not None: