TestCenter Reference
Base.py File Reference

Go to the source code of this file.

Classes

class  TestSupport.Base.MacrosShouldLogOnSuccessDecorator
 Decorator to globally enable or disable if the ASSERT_*/EXPECT_* macros log an info message on success. More...
 
class  TestSupport.Base.HtmlDiff
 

Namespaces

 TestSupport.Base
 Basic support functions.
 

Functions

def TestSupport.Base.clearEncodingCache ()
 
def TestSupport.Base.getSourceFileEncoding (filename)
 
def TestSupport.Base.decodeSourceCodeLine (filename, line)
 
def TestSupport.Base.getPackageList ()
 Returns the list of available packages. More...
 
def TestSupport.Base.getTestCaseContext ()
 Get the context of the test. More...
 
def TestSupport.Base.getModuleName ()
 Return the name of the currently tested module. More...
 
def TestSupport.Base.getTestFunctionName ()
 Returns the name of the current test function. More...
 
def TestSupport.Base.setMacrosShouldLogOnSuccess (logOnSuccess)
 Globally enables or disables if the ASSERT_*/EXPECT_* macros log an info message on success. More...
 
def TestSupport.Base.shouldLogOnSuccess (logOnSuccess=None)
 
def TestSupport.Base.LoggingDecorator (func)
 Internal decorator used for creating messages in compare methods. More...
 
def TestSupport.Base.escapedUnicode (value)
 
def TestSupport.Base.compareEqual (a, b, comment="", logOnSuccess=None)
 Compare the two given values for equality. More...
 
def TestSupport.Base.compareNotEqual (a, b, comment="", logOnSuccess=None)
 Compare the two given values for inequality. More...
 
def TestSupport.Base.compareLessThan (a, b, comment="", logOnSuccess=None)
 Compare the two given values if the first one is less than the second. More...
 
def TestSupport.Base.compareLessThanOrEqual (a, b, comment="", logOnSuccess=None)
 Compare the two given values if the first one is less than or equal to the second. More...
 
def TestSupport.Base.compareFloatEqual (a, b, comment="", epsilon=0.0001, logOnSuccess=None)
 Compare the two given float values if they are epsilon-equal. More...
 
def TestSupport.Base.compareFloatNotEqual (a, b, comment="", epsilon=0.0001, logOnSuccess=None)
 Compare the two given float values if they are epsilon-unequal. More...
 
def TestSupport.Base.compareFloatLessThan (a, b, comment="", logOnSuccess=None)
 Compare the two given float values if the first is less than the second. More...
 
def TestSupport.Base.compareFloatLessThanOrEqual (a, b, comment="", epsilon=0.0001, logOnSuccess=None)
 Compare the two given float values if the first is less than or equal to the second. More...
 
def TestSupport.Base.verifyTrue (expr, comment="", logOnSuccess=None, msg=None)
 If the given expression evaluates to False, an error is logged. More...
 
def TestSupport.Base.verifyFalse (expr, comment="", logOnSuccess=None, msg=None)
 If the given expression evaluates to True, an error is logged. More...
 
def TestSupport.Base.expectError (function, args=[], kargs={}, errorRegExp=None, preventReplacingMessageSeverity=False)
 Call the given function with the given parameters and expect an error. More...
 
def TestSupport.Base.expectWarning (function, args=[], kargs={}, warningRegExp=None)
 Call the given function with the given parameters and expect a warning. More...
 
def TestSupport.Base.expectWarningAndError (function, args=[], kargs={}, errorRegExp=None, warningRegExp=None)
 Call the given function with the given parameters and expect both a warning and an error. More...
 
def TestSupport.Base.ignoreError (function, args=(), kargs=None, errorRegExp=None, resultInfoDict=None)
 Call the given function with the given parameters and ignores potential errors. More...
 
def TestSupport.Base.ignoreWarning (function, args=(), kargs=None, warningRegExp=None, resultInfoDict=None)
 Call the given function with the given parameters and ignores potential warnings. More...
 
def TestSupport.Base.ignoreWarningAndError (function, args=[], kargs={}, errorRegExp=None, warningRegExp=None, resultInfoDict=None)
 Call the given function with the given parameters and ignore both a warning and an error. More...
 
def TestSupport.Base.expectInfo (function, args=[], kargs={}, infoRegExp=None, allowUnexpectedMessages=True)
 Call the given function with the given parameters and expect an info message. More...
 
def TestSupport.Base.hasNoWarning (warningRegExp=None)
 
def TestSupport.Base.hasWarning (warningRegExp=None)
 
def TestSupport.Base.hasError (errorRegExp=None)
 
def TestSupport.Base.hasWarningAndError (errorRegExp=None, warningRegExp=None)
 
def TestSupport.Base.hasInfo (infoRegExp=None, allowUnexpectedMessages=True)
 
def TestSupport.Base.getResultDirectory ()
 Getter for the directory used to save results. More...
 
def TestSupport.Base.getDataDirectory ()
 Method to return path to the data files. More...
 
def TestSupport.Base.getFileInDataDirectory (filename)
 Returns the absolute filename of a file in the data directory using getDataDirectory(). More...
 
def TestSupport.Base.existsFileInDataDirectory (filename)
 Checks if the given file exists in the data directory. More...
 
def TestSupport.Base.getExternalDataDirectory (name, subDirectory=None)
 Method to return path to the external data directory. More...
 
def TestSupport.Base.pushChangeSet ()
 Push a new ChangeSet to the stack. More...
 
def TestSupport.Base.popChangeSet ()
 Pop the last ChangeSet from the stack. More...
 
def TestSupport.Base.getHash (filename, hash="SHA1", encoder="Hex")
 Compute a hash for the content of the given file. More...
 
def TestSupport.Base.createExtraTestCaseResult (testCaseName, package, author, duration, maintainer=None, file=None, line=None, comment=None, showTestFunctionSortingLiterals=False)
 Creates an ExtraTestCaseResult object. More...
 
def TestSupport.Base.addExtraTestCaseResult (extraTestCaseResult)
 Adds an ExtraTestCaseResult object. More...
 
def TestSupport.Base.pushEnvironment ()
 Pushes the current environment dictionary on a stack, so that modifications can be applied and be popped again later. More...
 
def TestSupport.Base.popEnvironment ()
 Pops the last pushed environment dictionary from a stack and makes it the current one. More...
 
def TestSupport.Base.pushEnvironmentDecorator (func)
 
def TestSupport.Base.EnableHighPrecisionLoggingTimeStampsDecorator (func)
 
def TestSupport.Base.createHtmlDiff (fromLines, toLines, showOnlyContextOfDiff=False, numberOfContextLines=10)
 
def TestSupport.Base.disableTestFunctionIf (condition)
 
def TestSupport.Base.hardwareSupportsOffscreenRendering ()
 
def TestSupport.Base.runProcess (command, wait=True, expectSuccess=True, expectFailure=False, verbose=True, env=None)
 
def TestSupport.Base.verifyProcessResult (command, shortCommand, returncode, stdout, stderr, expectSuccess=True, expectFailure=False, verbose=True)
 
def TestSupport.Base.runPythonScript (script, arguments, wait=True, expectSuccess=True, expectFailure=False, verbose=True, env=None)
 

Variables

 TestSupport.Base.gEncodingRegExp = re.compile("^[ \t\v]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)")
 
dictionary TestSupport.Base.gEncodingCache = {}