def runTest(self): """Main entry point for the test suite""" files = self.__getDataFileList__() # run the tests failed = [] for filename in files: try: if not self.__loadAndTest__(filename): print("FAILED TO LOAD '%s'" % filename) failed.append(filename) except Exception as e: print("FAILED TO LOAD '%s' WITH ERROR:" % filename) print(e) failed.append(filename) finally: # Clear everything for the next test FrameworkManager.Instance().clear() # final say on whether or not it 'worked' print("----------------------------------------") if len(failed) != 0: print("SUMMARY OF FAILED FILES") for filename in failed: print(filename) raise RuntimeError("Failed to load %d of %d files" % (len(failed), len(files))) else: print("Successfully loaded %d files" % len(files))
def runTest(self): """Main entry point for the test suite""" files = self.__getDataFileList__() # run the tests failed = [] for filename in files: try: if not self.__loadSaveAndTest__(filename): print("FAILED TO LOAD AND SAVE '%s'" % filename) failed.append(filename) #pylint: disable=broad-except except ValueError as e: print("FAILED TO LOAD AND SAVE '%s' WITH ERROR:" % filename) print(e) failed.append(filename) finally: # Clear everything for the next test FrameworkManager.Instance().clear() # final say on whether or not it 'worked' print("----------------------------------------") if set(failed) != set(known_error_files): newfound_errors = list(set(failed) - set(known_error_files)) for file in newfound_errors: print("Failed: '%s'" % file) raise RuntimeError("System test failed.") else: print("Successfully loaded and saved %d files" % len(files))
def setup(app): """ Setup the directives when the extension is activated Args: app: The main Sphinx application object """ from mantid.api import FrameworkManager app.add_directive('algorithm', AlgorithmDirective) # connect event html collection to handler app.connect("html-collect-pages", html_collect_pages) # start framework manager to load plugins once FrameworkManager.Instance()
def _check_file_path(filename, mantid_alg): from mantid.api import AlgorithmManager, FrameworkManager, FileProperty FrameworkManager.Instance() alg = AlgorithmManager.createUnmanaged(mantid_alg) filename_property = [ prop for prop in alg.getProperties() if isinstance(prop, FileProperty) ] # Only with FileProperty can Mantid take fuzzy matches to filenames and run numbers # If the top level Load algorithm is requested (has no properties of its own) # we know that it's child algorithm uses FileProperty. If the child algorithm # is called directly we attempt to find FileProperty. Otherwise paths should be # absolute if filename_property or mantid_alg == 'Load': if not _is_mantid_loadable(filename): raise ValueError( f"Mantid cannot find {filename} and therefore will not load it." ) from None else: if not os.path.isfile(filename): raise ValueError( f"Cannot find file {filename} and therefore will not load it.")
def setUpClass(cls): FrameworkManager.Instance()
def clear_all_memory(self): """ Wrapper for call to FrameworkManager to clear all memory """ FrameworkManager.Instance().clear()
def runTest(self): """Main entry point for the test suite""" files = self.__getDataFileList__() # run the tests failed = [] for filename in files: try: if not self.__loadAndTest__(filename): print "FAILED TO LOAD '%s'" % filename failed.append(filename) except Exception, e: print "FAILED TO LOAD '%s' WITH ERROR:" % filename print e failed.append(filename) finally: # Clear everything for the next test FrameworkManager.Instance().clear() # final say on whether or not it 'worked' print "----------------------------------------" if len(failed) != 0: print "SUMMARY OF FAILED FILES" for filename in failed: print filename raise RuntimeError("Failed to load %d of %d files" % (len(failed), len(files))) else: print "Successfully loaded %d files" % len(files)