Package epyunit :: Module SubprocUnit :: Class SubprocessUnit
[hide private]
[frames] | no frames]

Class SubprocessUnit

source code


Wraps and checks results from execution of subprocesses by objects of class 'SProcUnitRules'.
Instance Methods [hide private]
 
__init__(self, **kargs)
Prepares the caller interface for subprocess unit tests.
source code
 
apply(self, res=None)
Applies the linked rule set onto the res-data.
source code
 
displayit(self, ret, **kargs)
Displays result list ret in selected format.
source code
 
setkargs(self, **kargs)
Sets provided parameters for the subprocess call context.
source code
 
setruleset(self, ruleset)
Assigns the ruleset object as current.
source code
 
getruleset(self)
Returns the current ruleset.
source code
 
get_proceed(self, s=None)
Verifies valid proceed type.
source code
 
__str__(self)
Prints the current unit parameters including parent.
source code
 
__repr__(self)
Prints the current representation of unit parameters including parent and ruleset.
source code

Inherited from SystemCalls.SystemCalls: callit, cancel, create, splitLines

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

Instance Variables [hide private]

Inherited from SystemCalls.SystemCalls: bufsize, console, emptyiserr, errasexcept, exectype, forcecmdcall, out, outtarget, proceed, synctype, tmax, tsig

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **kargs)
(Constructor)

source code 

Prepares the caller interface for subprocess unit tests.

Args:
**kargs: Parameter specific for the operation,
passed through to setkargs.
Returns:
When successful returns 'True'.
Raises:
passed through exceptions:
Overrides: object.__init__

apply(self, res=None)

source code 

Applies the linked rule set onto the res-data.

Args:
res: Result data to be filtered by a filter of type
'epyunit.SProcUnitRules'.
Returns:
When a rule set is present and could be applied successful returns 'True', else either 'False', or raises an exception.
Raises:
passed through exceptions:

displayit(self, ret, **kargs)

source code 

Displays result list ret in selected format.

Args:

ret: Data to be displayed.

**kargs:

outtarget: The target of display:

str: return as formatted string

stdout: print to sys.stdout

stderr: print to sys.stderr

out: Output for display, valid:

csv : CSV with sparse records

pass : pass through STDOUT and STDERR from subprocess

repr : Python 'repr()'

str : Python 'str()'

xml : XML

default:=self.out

Returns:

When successful returns

outtarget=='str': returns a printable formatted string

outtarget in ('stdout', 'stderr',):

'True': for success

'False': for failure

Raises:
passed through exceptions:
Overrides: SystemCalls.SystemCalls.displayit

setkargs(self, **kargs)

source code 

Sets provided parameters for the subprocess call context.

Applicable for the initial call of self.__init__(), and later modification. Called for each start of a subprocess in order to update optional the specific call context modification.

Calls the parent method by default, could be supressed by option for the update of current objects class only.

Args:

**kargs: Parameters specific for the operations.

noparent: Suppress call of parent class.

rules: Sets the rules object to be used.

Returns:
When successful returns 'True', else returns either 'False', or raises an exception.
Raises:
passed through exceptions:
Overrides: SystemCalls.SystemCalls.setkargs

setruleset(self, ruleset)

source code 

Assigns the ruleset object as current.

Args:
ruleset: The ruleset to be applied as unittest.
Replaces any previous.
Returns:
Returns the previous value of ruleset. If input is not an instance of 'SProcUnitRules' returns 'None'.
Raises:
passed through exceptions:

getruleset(self)

source code 

Returns the current ruleset.

Args:
**kargs: Parameters passed transparently to
created SProcUnitRules instance.

noparent: Suppress call of parent class.

Returns:
Returns the current rules.
Raises:
passed through exceptions:

get_proceed(self, s=None)

source code 

Verifies valid proceed type.

Args:
s: Requested type for validation.
Returns:
Supported types.
Raises:
passed through exceptions:
Overrides: SystemCalls.SystemCalls.get_proceed

__str__(self)
(Informal representation operator)

source code 
Prints the current unit parameters including parent.
Overrides: object.__str__

__repr__(self)
(Representation operator)

source code 
Prints the current representation of unit parameters including parent and ruleset.
Overrides: object.__repr__