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

namespace  TestSupport
 A package of python modules helping to build tests.
 
namespace  TestSupport.Base
 Basic support functions.
 

Functions

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