TestCenter Reference
TestSupport.Base Namespace Reference

Basic support functions. More...

Classes

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

Functions

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

Variables

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

Detailed Description

Basic support functions.

Function Documentation

◆ addExtraTestCaseResult()

def TestSupport.Base.addExtraTestCaseResult (   extraTestCaseResult)

Adds an ExtraTestCaseResult object.

See createExtraTestCaseResult().

Parameters
extraTestCaseResultA ExtraTestCaseResult object.

Definition at line 767 of file Base.py.

◆ clearEncodingCache()

def TestSupport.Base.clearEncodingCache ( )

Definition at line 42 of file Base.py.

Referenced by TestCenterAdvanced.Slave.Slave.unloadTestCase().

◆ compareEqual()

def TestSupport.Base.compareEqual (   a,
  b,
  comment = "",
  logOnSuccess = None 
)

Compare the two given values for equality.

If the two values are unequal an error is logged.

Parameters
aThe first value.
bThe second value.
commentOptional comment shown if comparison fails.
logOnSuccessPrint message in case of success.
Returns
True if values are equal.

Definition at line 199 of file Base.py.

References TestSupport.Base.escapedUnicode(), and TestSupport.Base.shouldLogOnSuccess().

◆ compareFloatEqual()

def TestSupport.Base.compareFloatEqual (   a,
  b,
  comment = "",
  epsilon = 0.0001,
  logOnSuccess = None 
)

Compare the two given float values if they are epsilon-equal.

Parameters
aThe first value.
bThe second value.
commentComment shown if comparison fails.
epsilonEpsilon used for float comparison.
logOnSuccesPrint message in case of success.
Returns
True if values are equal.

Definition at line 256 of file Base.py.

References TestSupport.Base.shouldLogOnSuccess().

◆ compareFloatLessThan()

def TestSupport.Base.compareFloatLessThan (   a,
  b,
  comment = "",
  logOnSuccess = None 
)

Compare the two given float values if the first is less than the second.

Parameters
aThe first value.
bThe second value.
commentComment shown if comparison fails.
logOnSuccesPrint message in case of success.
Returns
True if first value is less than the second.

Definition at line 283 of file Base.py.

References TestSupport.Base.shouldLogOnSuccess().

◆ compareFloatLessThanOrEqual()

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.

Parameters
aThe first value.
bThe second value.
commentComment shown if comparison fails.
epsilonEpsilon used for float comparison.
logOnSuccesPrint message in case of success.
Returns
True if first value is less than or equal to the second.

Definition at line 298 of file Base.py.

References TestSupport.Base.shouldLogOnSuccess().

◆ compareFloatNotEqual()

def TestSupport.Base.compareFloatNotEqual (   a,
  b,
  comment = "",
  epsilon = 0.0001,
  logOnSuccess = None 
)

Compare the two given float values if they are epsilon-unequal.

Parameters
aThe first value.
bThe second value.
commentComment shown if comparison fails.
epsilonEpsilon used for float comparison.
logOnSuccesPrint message in case of success.
Returns
True if values are unequal.

Definition at line 270 of file Base.py.

References TestSupport.Base.shouldLogOnSuccess().

◆ compareLessThan()

def TestSupport.Base.compareLessThan (   a,
  b,
  comment = "",
  logOnSuccess = None 
)

Compare the two given values if the first one is less than the second.

Parameters
aThe first value.
bThe second value.
commentOptional comment shown if comparison fails.
logOnSuccessPrint message in case of success.
Returns
True if the first value is less than the second.

Definition at line 230 of file Base.py.

References TestSupport.Base.escapedUnicode(), and TestSupport.Base.shouldLogOnSuccess().

◆ compareLessThanOrEqual()

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.

Parameters
aThe first value.
bThe second value.
commentOptional comment shown if comparison fails.
logOnSuccessPrint message in case of success.
Returns
True if the first value less than or equal to the second.

Definition at line 243 of file Base.py.

References TestSupport.Base.escapedUnicode(), and TestSupport.Base.shouldLogOnSuccess().

◆ compareNotEqual()

def TestSupport.Base.compareNotEqual (   a,
  b,
  comment = "",
  logOnSuccess = None 
)

Compare the two given values for inequality.

If the two values are equal an error is logged.

Parameters
aThe first value.
bThe second value.
commentOptional comment shown if comparison fails.
logOnSuccessPrint message in case of success.
Returns
True if the values are unequal.

Definition at line 215 of file Base.py.

References TestSupport.Base.escapedUnicode(), and TestSupport.Base.shouldLogOnSuccess().

◆ createExtraTestCaseResult()

def TestSupport.Base.createExtraTestCaseResult (   testCaseName,
  package,
  author,
  duration,
  maintainer = None,
  file = None,
  line = None,
  comment = None,
  showTestFunctionSortingLiterals = False 
)

Creates an ExtraTestCaseResult object.

The extra test case results enable test cases to provide additional results as a test case. For example, this is used for web tests, where the web application generates an xml report.

Parameters
testCaseNameThe name of the test case.
packageThe MeVisLab package of the test case.
authorThe author of the test case.
maintainerThe current maintainer of the test case.
Returns
The ExtraTestCaseResult object.

Definition at line 758 of file Base.py.

◆ createHtmlDiff()

def TestSupport.Base.createHtmlDiff (   fromLines,
  toLines,
  showOnlyContextOfDiff = False,
  numberOfContextLines = 10 
)

Definition at line 869 of file Base.py.

◆ decodeSourceCodeLine()

def TestSupport.Base.decodeSourceCodeLine (   filename,
  line 
)

Definition at line 68 of file Base.py.

References TestSupport.Base.getSourceFileEncoding().

Referenced by TestSupport.Base.LoggingDecorator().

◆ disableTestFunctionIf()

def TestSupport.Base.disableTestFunctionIf (   condition)

Definition at line 877 of file Base.py.

◆ EnableHighPrecisionLoggingTimeStampsDecorator()

def TestSupport.Base.EnableHighPrecisionLoggingTimeStampsDecorator (   func)

Definition at line 804 of file Base.py.

◆ escapedUnicode()

def TestSupport.Base.escapedUnicode (   value)
 Returns a unicode representation of value. If value is of type bytes then non-ASCII characters
    are escaped and a representation of the string is returned.
    For example, the 8-bit literal b'\x01' becomes 'u"\x01"'.

Definition at line 180 of file Base.py.

Referenced by TestSupport.Base.compareEqual(), TestSupport.Base.compareLessThan(), TestSupport.Base.compareLessThanOrEqual(), TestSupport.Base.compareNotEqual(), and TestSupport.Base.verifyTrue().

◆ existsFileInDataDirectory()

def TestSupport.Base.existsFileInDataDirectory (   filename)

Checks if the given file exists in the data directory.

Returns
True if the file exists in the data directory, False otherwise.

Definition at line 667 of file Base.py.

References TestSupport.Base.getFileInDataDirectory().

◆ expectError()

def TestSupport.Base.expectError (   function,
  args = [],
  kargs = {},
  errorRegExp = None,
  preventReplacingMessageSeverity = False 
)

Call the given function with the given parameters and expect an error.

Please note that nesting the expect{Warning, Error} methods will lead to invalid line numbers in the reports!

Parameters
functionThe function to be called.
argsList of parameters for the function.
kargsDictionary of named parameters for the function.
errorRegExpOptional RegexObject to control which errors are handled. (Strings will be assumed to be regular expressions and compiled automatically.)
preventReplacingMessageSeverityIf True, then the error state of the diagnosis console is not cleared. The test case must call MLAB.priv().clearLogState() itself in order to prevent it from failing. Default is False.
Returns
Return value of the called function.

Definition at line 345 of file Base.py.

◆ expectInfo()

def TestSupport.Base.expectInfo (   function,
  args = [],
  kargs = {},
  infoRegExp = None,
  allowUnexpectedMessages = True 
)

Call the given function with the given parameters and expect an info message.

Please note that nesting the expect{Warning, Error, Info} methods will lead to invalid line numbers in the reports!

Parameters
functionThe function to be called.
argsList of parameters for the function.
kargsDictionary of named parameters for the function.
infoRegExpOptional RegexObject to control which info messages are expected.
allowUnexpectedMessagesOptional flag to specify if unexpected messages are allowed.
Returns
Return value of the called function.

Definition at line 529 of file Base.py.

◆ expectWarning()

def TestSupport.Base.expectWarning (   function,
  args = [],
  kargs = {},
  warningRegExp = None 
)

Call the given function with the given parameters and expect a warning.

Please note that nesting the expect{Warning, Error, Info} methods will lead to invalid line numbers in the reports!

Parameters
functionThe function to be called.
argsList of parameters for the function.
kargsDictionary of named parameters for the function.
warningRegExpOptional RegexObject to control which warnings are handled. (Strings will be assumed to be regular expressions and compiled automatically.)
Returns
Return value of the called function.

Definition at line 370 of file Base.py.

◆ expectWarningAndError()

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.

Please note that nesting the expect{Warning, Error, Info} methods will lead to invalid line numbers in the reports!

Parameters
functionThe function to be called.
argsList of parameters for the function.
kargsDictionary of named parameters for the function.
errorRegExpOptional RegexObject to control which errors are handled.
warningRegExpOptional RegexObject to control which warnings are handled.
Returns
Return value of the called function.

Definition at line 395 of file Base.py.

◆ getDataDirectory()

def TestSupport.Base.getDataDirectory ( )

Method to return path to the data files.

Sometimes data is required for test case that should not reside inside the repository. This is where the dataDirectory option in the test case definition comes into play. This is the value that can be changed using this tag. The default is /Data.

Returns
The path to the directory where required data lives.

Definition at line 653 of file Base.py.

Referenced by TestSupport.Base.getFileInDataDirectory().

◆ getExternalDataDirectory()

def TestSupport.Base.getExternalDataDirectory (   name,
  subDirectory = None 
)

Method to return path to the external data directory.

Sometimes test cases require large data that should not be added to the version control. The external data directories provide a solution for such situations. If the subDirectory parameter is not given the same folder structure is used like in the calling test case. If the data directory does not exist None is returned. @params name The name of the external data directory (FME or MMS for example). @params subDirectory The sub directory in the external data store.

Returns
The path to the directory where required data lives.

Definition at line 681 of file Base.py.

◆ getFileInDataDirectory()

def TestSupport.Base.getFileInDataDirectory (   filename)

Returns the absolute filename of a file in the data directory using getDataDirectory().

Returns
The absolute filename of a file in the data directory.

Definition at line 660 of file Base.py.

References TestSupport.Base.getDataDirectory().

Referenced by TestSupport.Base.existsFileInDataDirectory().

◆ getHash()

def TestSupport.Base.getHash (   filename,
  hash = "SHA1",
  encoder = "Hex" 
)

Compute a hash for the content of the given file.

The hash is computed using the ImageHash module for images and using python's hashlib for other files.

Parameters
filenameThe file that should be hashed.
hashThe hash algorithm to use.
encoderThe encoder to use.
Returns
The computed hash or None in case of failure.

Definition at line 727 of file Base.py.

◆ getModuleName()

def TestSupport.Base.getModuleName ( )

Return the name of the currently tested module.

If the current test case is not a generic one None is returned.

Returns
The name of currently tested module.

Definition at line 101 of file Base.py.

◆ getPackageList()

def TestSupport.Base.getPackageList ( )

Returns the list of available packages.

The list of packages that is said to be thought of being available. This is for example helpful if a developer having installed all the source, but wants to verify only modules are used in seeAlso that are available in public installers.

Returns
List of packages that should be thought available.

Definition at line 84 of file Base.py.

◆ getResultDirectory()

def TestSupport.Base.getResultDirectory ( )

Getter for the directory used to save results.

All results should be collected in the given directory such that the generated data will be cleaned up when appropriate.

Returns
Path to the result directory.

Definition at line 642 of file Base.py.

◆ getSourceFileEncoding()

def TestSupport.Base.getSourceFileEncoding (   filename)

Definition at line 46 of file Base.py.

Referenced by TestSupport.Base.decodeSourceCodeLine().

◆ getTestCaseContext()

def TestSupport.Base.getTestCaseContext ( )

Get the context of the test.

The context in which the current test is loaded. This is where the test related network is available.

Returns
The current test case's context.

Definition at line 93 of file Base.py.

◆ getTestFunctionName()

def TestSupport.Base.getTestFunctionName ( )

Returns the name of the current test function.

Returns
The name of current test function.

Definition at line 107 of file Base.py.

◆ hardwareSupportsOffscreenRendering()

def TestSupport.Base.hardwareSupportsOffscreenRendering ( )

Definition at line 890 of file Base.py.

◆ hasError()

def TestSupport.Base.hasError (   errorRegExp = None)
Expect that the expression in the context logs an error that matches `errorRegExp`.
If `errorRegExp` is not given, any error is expected.

Usage:
with hasError():
    doStuff()

Definition at line 583 of file Base.py.

◆ hasInfo()

def TestSupport.Base.hasInfo (   infoRegExp = None,
  allowUnexpectedMessages = True 
)
Expect that the expression in the context logs an info entry that matches `infoRegExp`.
If `infoRegExp` is not given, any info message is expected.
If `allowUnexpectedMessages` is set to True (the default), messages that do not match `infoRegExp` are ignored,
otherwise they are considered a failure.

Usage:
with hasInfo(infoRegExp=".*Unknown module.*"):
    doStuff()

Definition at line 619 of file Base.py.

◆ hasNoWarning()

def TestSupport.Base.hasNoWarning (   warningRegExp = None)
Expect that the expression in the context block issues no warning that matches `warningRegExp`.
If `warningRegExp` is not given, no warning is expected at all.

Usage:
with hasNoWarning():
    doStuff()

Definition at line 549 of file Base.py.

◆ hasWarning()

def TestSupport.Base.hasWarning (   warningRegExp = None)
Expect that the expression in the context block logs a warning that matches `warningRegExp`.
If `warningRegExp` is not given, any warning is expected.

Usage:
with hasWarning():
    doStuff()

Definition at line 566 of file Base.py.

◆ hasWarningAndError()

def TestSupport.Base.hasWarningAndError (   errorRegExp = None,
  warningRegExp = None 
)
Expect that the expression in the context logs errors and warnings.
See `hasError` and `hasWarning` for the arguments.

Usage:
with hasWarningAndError():
    doStuff()

Definition at line 600 of file Base.py.

◆ ignoreError()

def TestSupport.Base.ignoreError (   function,
  args = (),
  kargs = None,
  errorRegExp = None,
  resultInfoDict = None 
)

Call the given function with the given parameters and ignores potential errors.

USE WITH CARE, usually you want to use expectError for explicit error handling!

Please note that nesting the ignore{Warning, Error} methods will lead to invalid line numbers in the reports!

Parameters
functionThe function to be called.
argsList of parameters for the function.
kargsDictionary of named parameters for the function.
errorRegExpOptional RegexObject to control which errors are ignored (non-matching ones will not be caught!). (Strings will be assumed to be regular expressions and compiled automatically.)
resultInfoDictOptional dictionary that, if provided, gets a new key 'hadIgnoredErrors' with a boolean value \ that allows the caller to react on whether there acually were errors or not
Returns
Return value of the called function.

Definition at line 425 of file Base.py.

◆ ignoreWarning()

def TestSupport.Base.ignoreWarning (   function,
  args = (),
  kargs = None,
  warningRegExp = None,
  resultInfoDict = None 
)

Call the given function with the given parameters and ignores potential warnings.

USE WITH CARE, usually you want to use expectWarning for explicit warning handling!

Please note that nesting the ignore{Warning, Warning} methods will lead to invalid line numbers in the reports!

Parameters
functionThe function to be called.
argsList of parameters for the function.
kargsDictionary of named parameters for the function.
warningRegExpOptional RegexObject to control which warnings are ignored (non-matching ones will not be caught!). (Strings will be assumed to be regular expressions and compiled automatically.)
resultInfoDictOptional dictionary that, if provided, gets a new key 'hadIgnoredWarnings' with a boolean value \ that allows the caller to react on whether there acually were warnings or not
Returns
Return value of the called function.

Definition at line 462 of file Base.py.

◆ ignoreWarningAndError()

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.

USE WITH CARE, usually you want to use expectWarningAndError for explicit warning handling!

Please note that nesting the ignore{Warning, Error, Info} methods will lead to invalid line numbers in the reports!

Parameters
functionThe function to be called.
argsList of parameters for the function.
kargsDictionary of named parameters for the function.
errorRegExpOptional RegexObject to control which errors are handled.
warningRegExpOptional RegexObject to control which warnings are handled.
resultInfoDictOptional dictionary that, if provided, gets new keys 'hadIgnoredWarnings' and 'hadIgnoredErrors' \ with boolean values that allow the caller to react on whether there acually were warnings/errors or not
Returns
Return value of the called function.

Definition at line 498 of file Base.py.

◆ LoggingDecorator()

def TestSupport.Base.LoggingDecorator (   func)

Internal decorator used for creating messages in compare methods.

Definition at line 162 of file Base.py.

References TestSupport.Base.decodeSourceCodeLine().

Referenced by TestSupport.Logging.setStopped().

◆ popChangeSet()

def TestSupport.Base.popChangeSet ( )

Pop the last ChangeSet from the stack.

At least two ChangeSets (the global one and the one for the function) must remain on the stack as they are not in the control of the user.

Definition at line 710 of file Base.py.

Referenced by TestCenterAdvanced.TestCase.TestCase.callFieldValueTestCase(), and TestCenterAdvanced.TestCase.TestCase.deactivate().

◆ popEnvironment()

def TestSupport.Base.popEnvironment ( )

Pops the last pushed environment dictionary from a stack and makes it the current one.

See pushEnvironment().

Returns
Returns if there was an environment dictionary to pop.

Definition at line 785 of file Base.py.

Referenced by TestSupport.Base.pushEnvironmentDecorator().

◆ pushChangeSet()

◆ pushEnvironment()

def TestSupport.Base.pushEnvironment ( )

Pushes the current environment dictionary on a stack, so that modifications can be applied and be popped again later.

See popEnvironment().

Definition at line 776 of file Base.py.

Referenced by TestSupport.Base.pushEnvironmentDecorator().

◆ pushEnvironmentDecorator()

def TestSupport.Base.pushEnvironmentDecorator (   func)

◆ runProcess()

def TestSupport.Base.runProcess (   command,
  wait = True,
  expectSuccess = True,
  expectFailure = False,
  verbose = True,
  env = None 
)

Definition at line 908 of file Base.py.

References TestSupport.Base.verifyProcessResult().

Referenced by TestSupport.Base.runPythonScript().

◆ runPythonScript()

def TestSupport.Base.runPythonScript (   script,
  arguments,
  wait = True,
  expectSuccess = True,
  expectFailure = False,
  verbose = True,
  env = None 
)

Definition at line 982 of file Base.py.

References TestSupport.Base.runProcess().

◆ setMacrosShouldLogOnSuccess()

def TestSupport.Base.setMacrosShouldLogOnSuccess (   logOnSuccess)

Globally enables or disables if the ASSERT_*/EXPECT_* macros log an info message on success.

It does not have to be reset, because the TestCenter enables it before each TestCase.

For example:

def setUpTestCase():
def setMacrosShouldLogOnSuccess(logOnSuccess)
Globally enables or disables if the ASSERT_*/EXPECT_* macros log an info message on success.
Definition: Base.py:128

Definition at line 128 of file Base.py.

Referenced by TestSupport.Base.MacrosShouldLogOnSuccessDecorator.__call__().

◆ shouldLogOnSuccess()

◆ verifyFalse()

def TestSupport.Base.verifyFalse (   expr,
  comment = "",
  logOnSuccess = None,
  msg = None 
)

If the given expression evaluates to True, an error is logged.

Parameters
exprThe expression that must evaluate to False.
commentOptional comment shown if expression is True.
logOnSuccesPrint message in case of success.
Returns
True if expression evaluates to False.

Definition at line 324 of file Base.py.

References TestSupport.Base.shouldLogOnSuccess().

◆ verifyProcessResult()

def TestSupport.Base.verifyProcessResult (   command,
  shortCommand,
  returncode,
  stdout,
  stderr,
  expectSuccess = True,
  expectFailure = False,
  verbose = True 
)

Definition at line 945 of file Base.py.

Referenced by TestSupport.Base.runProcess().

◆ verifyTrue()

def TestSupport.Base.verifyTrue (   expr,
  comment = "",
  logOnSuccess = None,
  msg = None 
)

If the given expression evaluates to False, an error is logged.

Parameters
exprThe expression that must evaluate to True.
commentOptional comment shown if expression is not True.
logOnSuccesPrint message in case of success.
Returns
True if expression evaluates to True.

Definition at line 310 of file Base.py.

References TestSupport.Base.escapedUnicode(), and TestSupport.Base.shouldLogOnSuccess().

Variable Documentation

◆ gEncodingCache

dictionary TestSupport.Base.gEncodingCache = {}

Definition at line 40 of file Base.py.

◆ gEncodingRegExp

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

Definition at line 39 of file Base.py.