‘epyunit.unittest.subprocess’ - Module

The module ‘epyunit.unittest.subprocess’ provides classes derived from ‘unittest’ for tests of arbitrary subprocesses.

Class: TestExecutable

class epyunit.unittest.subprocess.TestExecutable(*args, **kargs)[source]

Extends TestCase for subprocesses.

Methods

__init__

TestExecutable.__init__(*args, **kargs)[source]

Initializes the test case, passes parameters to ‘unittest.TestCase’.

Args:
**kargs: Parameter specific for the operation,
passed through to setkargs.
Returns:
When successful returns ‘True’.
Raises:
passed through exceptions:

__str__

TestExecutable.__str__()[source]

Prints the current test state.

assertEqual

TestExecutable.assertEqual(exp, cur=None)[source]

Asserts tuple result value of the called process.

Args:
exp: Expected value:
(exit-value, stdout-value, stderr-value)
cur: Current value:

(exit-value, stdout-value, stderr-value)

default:=self.spcache

Returns:
When successful returns the True, else raises an exception.
Raises:
Raises result of assertEqueal.

assertExit

TestExecutable.assertExit(exp, cur=None)[source]

Asserts on the exit value of the called process.

Args:
exp: Expected value:
exit-value
cur: Current value:

exit-value

default:=self.spcache[0]

Returns:
When successful returns the True, else raises an exception.
Raises:
Raises result of assertEqual.

assertExists

TestExecutable.assertExists(fpname)[source]

Asserts on the existance of a filesystem node.

Args:
fpname: Filesystem node.
Returns:
When successful returns the True, else raises an exception.
Raises:
Raises result FileNodeDoesNotExists.

assertStderr

TestExecutable.assertStderr(exp, cur=None)[source]

Asserts a list of provided regexpr on the STDERR of the called process.

Args:
exp: Expected value:
stderr-value
cur: Current value:

stderr-value

default:=self.spcache[2]

Returns:
When successful returns the True, else raises an exception.
Raises:
Raises result of assertEqual.

assertStdout

TestExecutable.assertStdout(exp, cur=None)[source]

Asserts a list of provided regexpr on the STDOUT of the called process.

Args:
exp: Expected value:
stdout-value
cur: Current value:

stdout-value

default:=self.spcache[1]

Returns:
When successful returns the True, else raises an exception.
Raises:
Raises result of assertEqual.

callSubprocess

TestExecutable.callSubprocess(callstr, **kargs)[source]

Calls a subprocess and fetches the result data.

Args:

callstr: Complete call string for subprocess.

**kargs:

Pass-through parameters for ‘SystemCalls.callit()’.

cache:
Caches results.
Returns:

When successful returns the tupel:

returnvalue := (exit-value, stdout-value, stderr-value)
Raises:
passed through exceptions:

setkargs

TestExecutable.setkargs(**kargs)[source]

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.

Args:

**kargs: Parameters specific for the operations.

cache:
Sets caching of the results for subprocess call.
noparent:
Suppress call of parent class.
rules:
Sets the rules object to be used. See: epyunit.SubprocUnit.SProcUnitRules
spunit:
Sets the subprocess unit. See: epyunit.SubprocUnit.SProcUnit
Returns:
When successful returns ‘True’, else returns either ‘False’, or raises an exception.
Raises:
passed through exceptions:

Exceptions

exception epyunit.unittest.subprocess.TestExecutableException[source]

Application error for called executable.