def skip(self): """ Override and return a string depending on whether the directive should be skipped. If empty then the directive should be processed otherwise the string should contain the error message The default is to skip (and warn) if the algorithm is not known. Returns: str: Return error message string if the directive should be skipped """ from mantid.api import FunctionFactory name, version = self.algorithm_name(), self.algorithm_version() msg = "" if version is None: # it is a fit function if name in FunctionFactory.getFunctionNames(): return "" else: msg = "No fit function '%s', skipping directive" % name else: if AlgorithmFactory.exists(name, version): return "" else: msg = "No algorithm '%s' version '%d', skipping directive" % ( name, version) # warn the user if len(msg) > 0: logger = get_logger(__name__, self.state.document.settings.env.app) logger.verbose(msg) return msg
def doctest_to_xunit(app, exception): """ If the runner was 'doctest'then parse the "output.txt" file and produce an XUnit-style XML file, otherwise it does nothing. Arguments: app (Sphinx.application): Sphinx application object exception: (Exception): If an exception was raised then it is given here. It is simply re-raised if an error occurred """ logger = get_logger(__name__, app) if exception: import traceback traceback.print_exc() if app.builder.name != "doctest": logger.debug("Skipping xunit parsing for builder '%s'" % app.builder.name) return import os doctest_file = os.path.join(app.builder.outdir, DOCTEST_OUTPUT) logger.debug("Parsing doctest output file '%s'" % doctest_file) doctests = DocTestOutputParser(doctest_file) logger.debug("Saving doctest as xunit to file '%s'" % doctest_file) xunit_file = os.path.join(app.builder.outdir, XUNIT_OUTPUT) doctests.as_xunit(xunit_file)