diff --git a/lib/galaxy/tool_util/verify/interactor.py b/lib/galaxy/tool_util/verify/interactor.py index da4bf13baf3b..d08804ae58b3 100644 --- a/lib/galaxy/tool_util/verify/interactor.py +++ b/lib/galaxy/tool_util/verify/interactor.py @@ -1430,8 +1430,6 @@ def verify_tool( raise e if not expected_failure_occurred: - assert data_list or data_collection_list - try: job_stdio = _verify_outputs( testdef, test_history, jobs, data_list, data_collection_list, galaxy_interactor, quiet=quiet @@ -1489,7 +1487,6 @@ def _handle_def_errors(testdef): def _verify_outputs(testdef, history, jobs, data_list, data_collection_list, galaxy_interactor, quiet=False): assert len(jobs) == 1, "Test framework logic error, somehow tool test resulted in more than one job." job = jobs[0] - found_exceptions: List[Exception] = [] def register_exception(e: Exception): @@ -1542,29 +1539,36 @@ def register_exception(e: Exception): outfile = output_dict["value"] attributes = output_dict["attributes"] output_testdef = Bunch(name=name, outfile=outfile, attributes=attributes) + output_data = None try: output_data = data_list[name] except (TypeError, KeyError): # Legacy - fall back on ordered data list access if data_list is # just a list (case with twill variant or if output changes its # name). - if hasattr(data_list, "values"): - output_data = list(data_list.values())[output_index] - else: - output_data = data_list[len(data_list) - len(testdef.outputs) + output_index] - assert output_data is not None - try: - galaxy_interactor.verify_output( - history, - jobs, - output_data, - output_testdef=output_testdef, - tool_id=job["tool_id"], - maxseconds=maxseconds, - tool_version=testdef.tool_version, - ) - except Exception as e: - register_exception(e) + try: + if hasattr(data_list, "values"): + output_data = list(data_list.values())[output_index] + else: + output_data = data_list[len(data_list) - len(testdef.outputs) + output_index] + except IndexError: + error = AssertionError( + f"Tool did not produce an output with name '{name}' (or at index {output_index})" + ) + register_exception(error) + if output_data: + try: + galaxy_interactor.verify_output( + history, + jobs, + output_data, + output_testdef=output_testdef, + tool_id=job["tool_id"], + maxseconds=maxseconds, + tool_version=testdef.tool_version, + ) + except Exception as e: + register_exception(e) other_checks = { "command_line": "Command produced by the job", diff --git a/test/functional/tools/output_filter.xml b/test/functional/tools/output_filter.xml index 2002fee03826..4a891399210d 100644 --- a/test/functional/tools/output_filter.xml +++ b/test/functional/tools/output_filter.xml @@ -1,15 +1,15 @@ test for output filtering and expect_num_outputs 1 && -echo 'test' > 2 && -echo 'test' > 3 && -echo 'test' > 4 && -echo 'test' > 5 && -echo 'test' > p1.forward && -echo 'test' > p1.reverse && -echo 'test' > p2.forward && -echo 'test' > p2.reverse +echo '1' > 1 && +echo '2' > 2 && +echo '3' > 3 && +echo '4' > 4 && +echo '5' > 5 && +echo 'p1.forward' > p1.forward && +echo 'p1.reverse' > p1.reverse && +echo 'p2.forward' > p2.forward && +echo 'p2.reverse' > p2.reverse ]]> @@ -26,7 +26,6 @@ echo 'test' > p2.reverse filter_text_1 == "foo" - produce_collection is True @@ -37,40 +36,31 @@ echo 'test' > p2.reverse - + - + - - - - - - + - + - - - - - - + - + + @@ -78,68 +68,61 @@ echo 'test' > p2.reverse + + + - + - + - - - - - - + - + - + - + - + - - - - - - + - + - + @@ -147,24 +130,24 @@ echo 'test' > p2.reverse - + - + - + - +