Package PyFoam :: Package Infrastructure :: Module CTestRun :: Class CTestRun
[hide private]
[frames] | no frames]

Class CTestRun

source code


This class runs a solver on a test case, examines the results and fails if they don't live up the expectations

Instance Methods [hide private]
 
__doInit(self, 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
source code
 
__getitem__(self, key)
Get a parameter
source code
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__recursiveInit(self, theClass, called)
Automatically call the 'init'-method of the whole tree
source code
 
__setParameterAsUsed(self, keys) source code
 
addFunctionObjects(self, templateFile)
Add entries for libraries and functionObjects to the controlDict (if they don't exist
source code
 
addToClone(self, *args) source code
 
autoDecompose(self)
Decomposition used if no callback is specified
source code
 
autoReconstruct(self)
Reconstruction used if no callback is specified
source code
 
casePrepare(self)
Callback to prepare the case.
source code
 
cloneData(self, src, dst)
Copy files recurivly into a case
source code
 
compareSamples(self, data, reference, fields, time=None, line=None, scaleData=1, offsetData=0, scaleX=1, offsetX=0, useReferenceForComparison=False)
Compare sample data and return the statistics
source code
 
compareTimelines(self, data, reference, fields)
Compare timeline data and return the statistics
source code
 
controlDict(self)
Access a representation of the controlDict of the case
source code
 
dataDir(self) source code
 
decompose(self)
Callback to do the decomposition (if automatic is not sufficient)
source code
 
endTest(self) source code
 
execute(self, *args, **kwargs)
Execute the passed arguments on the case and check if everything went alright
source code
 
fail(self, *args)
To be called if the test failed but other tests should be tried
source code
 
failGeneral(self, prefix, *args) source code
 
fatalFail(self, *args) source code
 
generalTest(self, testFunction, args, *message) source code
 
isBigger(self, value, threshold=0, message='') source code
 
isEqual(self, value, target=0, tolerance=1e-10, message='') source code
 
isNotEqual(self, value, target=0, tolerance=1e-10, message='') source code
 
isSmaller(self, value, threshold=0, message='') source code
 
line(self) source code
 
meshPrepare(self)
Callback to prepare the mesh for the case.
source code
 
messageGeneral(self, prefix, say, *args)
Everything that passes through this method will be repeated in the end
source code
 
parallelPrepare(self)
Callback to prepare the case in parallel (after it was decomposed).
source code
 
parameterValues(self) source code
 
postprocess(self)
Callback to run after the solver has finished.
source code
 
preRunTestCheckMesh(self)
This test is always run.
source code
 
processOptions(self)
Select which phase of the test should be run
source code
 
readRunInfo(self)
read the runInfo from a file
source code
 
reconstruct(self)
Callback to do the reconstruction (if automatic is not sufficient)
source code
 
run(self)
Run the actual test
source code
 
runAndCatchExceptions(self, func, *args, **kwargs)
Run a callable and catch Python-exceptions if they occur
source code
 
runCommand(self, *args)
Run a command and let it directly write to the output
source code
 
runInfo(self)
return the run information.
source code
 
runTests(self, namePrefix, warnSerial=False)
Run all methods that fit a certain name prefix
source code
 
setParameters(self, **kwargs)
Update the parameters with a set of keyword-arguments
source code
 
setTimeout(self, quiet=False) source code
 
shell(self, *args)
Run a command in the case directory and let it directly write to the output
source code
 
shortTestName(self) source code
 
sizeClassString(self) source code
 
solution(self)
Access to a SolutionDirectory-object that represents the current solution
source code
 
status(self, *args)
print a status message about the test
source code
 
testName(self)
Return the full test name with which this test is identified
source code
 
warn(self, *args) source code
 
which(self, command)
Like the regular which command - return the full path to an executable
source code
 
workDir(self) source code
 
wrapACallback(self, name)
Has to be a separate method because the loop in wrapCallbacks didn't work
source code
 
wrapCallbacks(self)
Wrap the callback methods with a Python exception handler.
source code
 
writeRunInfo(self)
read the runInfo from a file
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
a new object with type S, a subtype of T
__new__(cls, *args, **kwargs) source code
Class Variables [hide private]
  timeoutDefinitions = [('unknown', 60), ('tiny', 60), ('small',...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__doInit(self, solver, originalCase, minimumRunTime=None, referenceData=None, tailLength=50, headLength=50, **kwargs)

source code 

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)
  • minimumRuntime - the solver has to run at least to this time to be considered "ran successful"
  • referenceData - directory with data that is used for testing
  • tailLength - output that many lines from the end of the solver output
  • headLength - output that many lines from the beginning of the solver output

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

__new__(cls, *args, **kwargs)
Static Method

source code 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__
(inherited documentation)

addFunctionObjects(self, templateFile)

source code 

Add entries for libraries and functionObjects to the controlDict (if they don't exist

Parameters:
  • templateFile - file withe the data that should be added

casePrepare(self)

source code 

Callback to prepare the case. Default behaviour is to do nothing

cloneData(self, src, dst)

source code 

Copy files recurivly into a case

Parameters:
  • src - the source directory the files come fro
  • dst - the destination directory the files go to

compareSamples(self, data, reference, fields, time=None, line=None, scaleData=1, offsetData=0, scaleX=1, offsetX=0, useReferenceForComparison=False)

source code 

Compare sample data and return the statistics

Parameters:
  • data - the name of the data directory
  • reference - the name of the directory with the reference data
  • fields - list of the fields to compare
  • time - the time to compare for. If empty the latest time is used

compareTimelines(self, data, reference, fields)

source code 

Compare timeline data and return the statistics

Parameters:
  • data - the name of the data directory
  • reference - the name of the directory with the reference data
  • fields - list of the fields to compare

execute(self, *args, **kwargs)

source code 

Execute the passed arguments on the case and check if everything went alright

Parameters:
  • regexps - a list of regular expressions that the output should be scanned for

fail(self, *args)

source code 

To be called if the test failed but other tests should be tried

Parameters:
  • args - arbitrary number of arguments that build the fail-message

failGeneral(self, prefix, *args)

source code 
Parameters:
  • args - arbitrary number of arguments that build the fail-message
  • prefix - General classification of the failure

fatalFail(self, *args)

source code 
Parameters:
  • args - arbitrary number of arguments that build the fail-message

meshPrepare(self)

source code 

Callback to prepare the mesh for the case. Default behaviour is to run blockMesh on the case

messageGeneral(self, prefix, say, *args)

source code 

Everything that passes through this method will be repeated in the end

Parameters:
  • args - arbitrary number of arguments that build the fail-message
  • prefix - General classification of the message

parallelPrepare(self)

source code 

Callback to prepare the case in parallel (after it was decomposed). Default behaviour is to do nothing

postprocess(self)

source code 

Callback to run after the solver has finished. Default behaviour is to do nothing

preRunTestCheckMesh(self)

source code 

This test is always run. If this is not desirable it has to be overridden in a child-class

runAndCatchExceptions(self, func, *args, **kwargs)

source code 

Run a callable and catch Python-exceptions if they occur

Parameters:
  • func - The actual thing to be run

runInfo(self)

source code 

return the run information. If the solver was actually run

shell(self, *args)

source code 

Run a command in the case directory and let it directly write to the output

Parameters:
  • workingDirectory - change to this directory

warn(self, *args)

source code 
Parameters:
  • args - arbitrary number of arguments that build the warning-message

wrapCallbacks(self)

source code 

Wrap the callback methods with a Python exception handler. This is not done here so that methoids that the child classes overwrote will be wrapped to


Class Variable Details [hide private]

timeoutDefinitions

Value:
[('unknown', 60),
 ('tiny', 60),
 ('small', 300),
 ('medium', 1800),
 ('big', 7200),
 ('huge', 43200),
 ('monster', 172800),
 ('unlimited', 2592000)]