def verify_hid(self, filename, hda_id, attributes, shed_tool_id, hid="", dataset_fetcher=None): assert dataset_fetcher is not None def get_filename(test_filename): return self.get_filename(test_filename, shed_tool_id=shed_tool_id) def verify_extra_files(extra_files): self._verify_extra_files_content(extra_files, hda_id, shed_tool_id=shed_tool_id, dataset_fetcher=dataset_fetcher) data = dataset_fetcher(hda_id) item_label = "History item %s" % hid verify( item_label, data, attributes=attributes, filename=filename, get_filename=get_filename, keep_outputs_dir=self.keepOutdir, verify_extra_files=verify_extra_files, )
def _verify_composite_datatype_file_content(self, file_name, hda_id, base_name=None, attributes=None, dataset_fetcher=None, shed_tool_id=None): assert dataset_fetcher is not None def get_filename(test_filename): return self.get_filename(test_filename, shed_tool_id=shed_tool_id) data = dataset_fetcher(hda_id, base_name) item_label = "History item %s" % hda_id try: verify( item_label, data, attributes=attributes, filename=file_name, get_filename=get_filename, keep_outputs_dir=self.keepOutdir, ) except AssertionError as err: errmsg = 'Composite file (%s) of %s different than expected, difference:\n' % ( base_name, item_label) errmsg += str(err) raise AssertionError(errmsg)
def check_output(runnable, output_properties, test_properties, **kwds): """Use galaxy-lib to check a test output. Return a list of strings describing the problems encountered, and empty list indicates no problems were detected. Currently this will only ever return at most one detected problem because of the way galaxy-lib throws exceptions instead of returning individual descriptions - but this may be enhanced in the future. """ get_filename = _test_filename_getter(runnable) path = output_properties["path"] output_content = open(path, "rb").read() expected_file = test_properties.get("file", None) job_output_files = kwds.get("job_output_files", None) item_label = "Output with path %s" % path problems = [] try: verify( item_label, output_content, attributes=test_properties, filename=expected_file, get_filename=get_filename, keep_outputs_dir=job_output_files, verify_extra_files=None, ) except AssertionError as e: problems.append(str(e)) return problems
def check_output(runnable, output_properties, test_properties, **kwds): """Use galaxy-lib to check a test output. Return a list of strings describing the problems encountered, and empty list indicates no problems were detected. Currently this will only ever return at most one detected problem because of the way galaxy-lib throws exceptions instead of returning individual descriptions - but this may be enhanced in the future. """ get_filename = _test_filename_getter(runnable) path = output_properties["path"] output_content = open(path, "rb").read() # Support Galaxy-like file location (using "file") or CWL-like ("path" or "location"). expected_file = test_properties.get("file", None) if expected_file is None: expected_file = test_properties.get("path", None) if expected_file is None: expected_file = test_properties.get("location", None) job_output_files = kwds.get("job_output_files", None) item_label = "Output with path %s" % path problems = [] if "asserts" in test_properties: # TODO: break fewer abstractions here... from galaxy.tools.parser.yaml import __to_test_assert_list test_properties["assert_list"] = __to_test_assert_list( test_properties["asserts"]) try: verify( item_label, output_content, attributes=test_properties, filename=expected_file, get_filename=get_filename, keep_outputs_dir=job_output_files, verify_extra_files=None, ) except AssertionError as e: problems.append(str(e)) return problems
def verify_hid(self, filename, hda_id, attributes, shed_tool_id, hid="", dataset_fetcher=None): assert dataset_fetcher is not None def get_filename(test_filename): return self.get_filename(test_filename, shed_tool_id=shed_tool_id) def verify_extra_files(extra_files): self._verify_extra_files_content(extra_files, hda_id, shed_tool_id=shed_tool_id, dataset_fetcher=dataset_fetcher) data = dataset_fetcher(hda_id) item_label = "History item %s" % hid verify( item_label, data, attributes=attributes, filename=filename, get_filename=get_filename, keep_outputs_dir=self.keepOutdir, verify_extra_files=verify_extra_files, )
def check_output(runnable, output_properties, test_properties, **kwds): """Use galaxy-lib to check a test output. Return a list of strings describing the problems encountered, and empty list indicates no problems were detected. Currently this will only ever return at most one detected problem because of the way galaxy-lib throws exceptions instead of returning individual descriptions - but this may be enhanced in the future. """ get_filename = _test_filename_getter(runnable) path = output_properties["path"] output_content = open(path, "rb").read() # Support Galaxy-like file location (using "file") or CWL-like ("path" or "location"). expected_file = test_properties.get("file", None) if expected_file is None: expected_file = test_properties.get("path", None) if expected_file is None: expected_file = test_properties.get("location", None) job_output_files = kwds.get("job_output_files", None) item_label = "Output with path %s" % path problems = [] if "asserts" in test_properties: # TODO: break fewer abstractions here... from galaxy.tools.parser.yaml import __to_test_assert_list test_properties["assert_list"] = __to_test_assert_list(test_properties["asserts"]) try: verify( item_label, output_content, attributes=test_properties, filename=expected_file, get_filename=get_filename, keep_outputs_dir=job_output_files, verify_extra_files=None, ) except AssertionError as e: problems.append(str(e)) return problems
def _verify_composite_datatype_file_content(self, file_name, hda_id, base_name=None, attributes=None, dataset_fetcher=None, shed_tool_id=None): assert dataset_fetcher is not None def get_filename(test_filename): return self.get_filename(test_filename, shed_tool_id=shed_tool_id) data = dataset_fetcher(hda_id, base_name) item_label = "History item %s" % hda_id try: verify( item_label, data, attributes=attributes, filename=file_name, get_filename=get_filename, keep_outputs_dir=self.keepOutdir, ) except AssertionError as err: errmsg = 'Composite file (%s) of %s different than expected, difference:\n' % (base_name, item_label) errmsg += str(err) raise AssertionError(errmsg)