PyFoam.Infrastructure.CTestRun module¶
A wrapper to run a solver as a CTest
-
class
PyFoam.Infrastructure.CTestRun.
CTestRun
[source]¶ Bases:
object
This class runs a solver on a test case, examines the results and fails if they don’t live up the expectations
-
_CTestRun__doInit
(solver, originalCase, minimumRunTime=None, referenceData=None, tailLength=50, headLength=50, **kwargs)¶ Initialzation method to be called before running the actual test (purpose of this method is to avoid cascaded of constructor-calls
- Parameters
solver – name of the solver to test
originalCase – location of the original case files (they
will be copied) :param minimumRuntime: the solver has to run at least to this time to be considered “ran successful” :param referenceData: directory with data that is used for testing :param tailLength: output that many lines from the end of the solver output :param headLength: output that many lines from the beginning of the solver output
-
_CTestRun__recursiveInit
(theClass, called)¶ Automatically call the ‘init’-method of the whole tree
-
_CTestRun__setParameterAsUsed
(keys)¶
-
__dict__
= mappingproxy({'__module__': 'PyFoam.Infrastructure.CTestRun', '__doc__': "This class runs a solver on a test case, examines the results\n and fails if they don't live up the expectations", '__init__': <function CTestRun.__init__>, '__new__': <staticmethod object>, '_CTestRun__recursiveInit': <function CTestRun.__recursiveInit>, 'addToClone': <function CTestRun.addToClone>, 'setParameters': <function CTestRun.setParameters>, 'parameterValues': <function CTestRun.parameterValues>, '_CTestRun__setParameterAsUsed': <function CTestRun.__setParameterAsUsed>, '__getitem__': <function CTestRun.__getitem__>, 'shortTestName': <function CTestRun.shortTestName>, 'testName': <function CTestRun.testName>, 'timeoutDefinitions': [('unknown', 60), ('tiny', 60), ('small', 300), ('medium', 1800), ('big', 7200), ('huge', 43200), ('monster', 172800), ('unlimited', 2592000)], 'sizeClassString': <function CTestRun.sizeClassString>, 'setTimeout': <function CTestRun.setTimeout>, '_CTestRun__doInit': <function CTestRun.__doInit>, 'readRunInfo': <function CTestRun.readRunInfo>, 'writeRunInfo': <function CTestRun.writeRunInfo>, 'wrapACallback': <function CTestRun.wrapACallback>, 'wrapCallbacks': <function CTestRun.wrapCallbacks>, 'processOptions': <function CTestRun.processOptions>, 'run': <function CTestRun.run>, 'workDir': <function CTestRun.workDir>, 'dataDir': <function CTestRun.dataDir>, 'addFunctionObjects': <function CTestRun.addFunctionObjects>, 'cloneData': <function CTestRun.cloneData>, 'runCommand': <function CTestRun.runCommand>, 'shell': <function CTestRun.shell>, 'execute': <function CTestRun.execute>, 'runInfo': <function CTestRun.runInfo>, 'solution': <function CTestRun.solution>, 'controlDict': <function CTestRun.controlDict>, 'line': <function CTestRun.line>, 'status': <function CTestRun.status>, 'messageGeneral': <function CTestRun.messageGeneral>, 'failGeneral': <function CTestRun.failGeneral>, 'warn': <function CTestRun.warn>, 'fail': <function CTestRun.fail>, 'fatalFail': <function CTestRun.fatalFail>, 'endTest': <function CTestRun.endTest>, 'which': <function CTestRun.which>, 'runAndCatchExceptions': <function CTestRun.runAndCatchExceptions>, 'runTests': <function CTestRun.runTests>, 'generalTest': <function CTestRun.generalTest>, 'compareSamples': <function CTestRun.compareSamples>, 'compareTimelines': <function CTestRun.compareTimelines>, 'isNotEqual': <function CTestRun.isNotEqual>, 'isEqual': <function CTestRun.isEqual>, 'isBigger': <function CTestRun.isBigger>, 'isSmaller': <function CTestRun.isSmaller>, 'preRunTestCheckMesh': <function CTestRun.preRunTestCheckMesh>, 'autoDecompose': <function CTestRun.autoDecompose>, 'autoReconstruct': <function CTestRun.autoReconstruct>, 'meshPrepare': <function CTestRun.meshPrepare>, 'casePrepare': <function CTestRun.casePrepare>, 'parallelPrepare': <function CTestRun.parallelPrepare>, 'postprocess': <function CTestRun.postprocess>, 'decompose': <function CTestRun.decompose>, 'reconstruct': <function CTestRun.reconstruct>, '__dict__': <attribute '__dict__' of 'CTestRun' objects>, '__weakref__': <attribute '__weakref__' of 'CTestRun' objects>})¶
-
__module__
= 'PyFoam.Infrastructure.CTestRun'¶
-
static
__new__
(cls, *args, **kwargs)[source]¶ Create and return a new object. See help(type) for accurate signature.
-
__weakref__
¶ list of weak references to the object (if defined)
-
addFunctionObjects
(templateFile)[source]¶ Add entries for libraries and functionObjects to the controlDict (if they don’t exist :param templateFile: file withe the data that should be added
-
cloneData
(src, dst)[source]¶ Copy files recurivly into a case :param src: the source directory the files come fro :param dst: the destination directory the files go to
-
compareSamples
(data, reference, fields, time=None, line=None, scaleData=1, offsetData=0, scaleX=1, offsetX=0, useReferenceForComparison=False)[source]¶ Compare sample data and return the statistics :param data: the name of the data directory :param reference:the name of the directory with the reference data :param fields: list of the fields to compare :param time: the time to compare for. If empty the latest time is used
-
compareTimelines
(data, reference, fields)[source]¶ Compare timeline data and return the statistics :param data: the name of the data directory :param reference:the name of the directory with the reference data :param fields: list of the fields to compare
-
execute
(*args, **kwargs)[source]¶ Execute the passed arguments on the case and check if everything went alright :param regexps: a list of regular expressions that the output should be scanned for
-
fail
(*args)[source]¶ To be called if the test failed but other tests should be tried :param args: arbitrary number of arguments that build the fail-message
-
failGeneral
(prefix, *args)[source]¶ - Parameters
args – arbitrary number of arguments that build the
fail-message :param prefix: General classification of the failure
-
fatalFail
(*args)[source]¶ - Parameters
args – arbitrary number of arguments that build the
fail-message
-
meshPrepare
()[source]¶ Callback to prepare the mesh for the case. Default behaviour is to run blockMesh on the case
-
messageGeneral
(prefix, say, *args)[source]¶ Everything that passes through this method will be repeated in the end :param args: arbitrary number of arguments that build the fail-message :param prefix: General classification of the message
-
parallelPrepare
()[source]¶ Callback to prepare the case in parallel (after it was decomposed). Default behaviour is to do nothing
-
postprocess
()[source]¶ Callback to run after the solver has finished. Default behaviour is to do nothing
-
preRunTestCheckMesh
()[source]¶ This test is always run. If this is not desirable it has to be overridden in a child-class
-
runAndCatchExceptions
(func, *args, **kwargs)[source]¶ Run a callable and catch Python-exceptions if they occur :param func: The actual thing to be run
-
shell
(*args)[source]¶ Run a command in the case directory and let it directly write to the output :param workingDirectory: change to this directory
-
timeoutDefinitions
= [('unknown', 60), ('tiny', 60), ('small', 300), ('medium', 1800), ('big', 7200), ('huge', 43200), ('monster', 172800), ('unlimited', 2592000)]¶
-
wrapACallback
(name)[source]¶ Has to be a separate method because the loop in wrapCallbacks didn’t work
-