pysys package

Module contents

PySys System Test Framework.

PySys has been designed to provide a generic extensible multi-threaded framework for the organisation and execution of system level testcases. It provides a clear model of what a testcases is, how it is structured on disk, how it is executed and validated, and how the outcome is reported for test auditing purposes.

Testcases are instances of a base test class (pysys.basetest.BaseTest) which provides core functionality for cross platform process management, monitoring and manipulation; in this manner an application under test (AUT) can be started and interacted with directly within a testcase. The base test class additionally provides a set of standard validation techniques based predominantly on regular expression matching within text files (e.g. stdout, logfile of the AUT etc). Testcases are executed through a base runner (pysys.baserunner.BaseRunner) which provides the mechanism to control concurrent testcase flow and auditing. In both cases the base test and runner classes have been designed to be extended for a particular AUT, e.g. to allow a higher level of abstraction over the AUT, tear up and tear down prior to executing a set of testcases etc.

PySys allows automated regression testcases to be built rapidly. Where an AUT cannot be tested in an automated fashion, testcases can be written to make use of a manual test user interface (pysys.manual.ui.ManualTester) which allows the steps required to execute the test to be presented to a tester in a concise and navigable manner. The tight integration of both manual and automated testcases provides a single framework for all test organisation requirements.

class pysys.ThreadFilter[source]

Bases: logging.Filterer

Filter to disallow log records from the current thread.

Within pysys, logging to standard output is only enabled from the main thread of execution (that in which the test runner class executes). When running with more than one test worker thread, logging to file of the test run log is performed through a file handler, which only allows logging from that thread. To disable either of these, use an instance of this class from the thread in question, adding to the root logger via log.addFilter(ThreadFilter()).

__init__()[source]

Overrides logging.Filterer.__init__

filter(record)[source]

Implementation of logging.Filterer.filter to block from the creating thread.

class pysys.ThreadedFileHandler(filename)[source]

Bases: logging.FileHandler

File handler to only log from the creating thread.

Overrides logging.FileHandler to only allow logging to file from the thread than created the class instance and added to the root logger via log.addHandler(ThreadFileHandler(filename)).

This is used to pass log output from the specific test that creates this handler to the associated run.log.

__init__(filename)[source]

Overrides logging.FileHandler.__init__

emit(record)[source]

Overrides logging.FileHandler.emit.

class pysys.ThreadedStreamHandler(strm)[source]

Bases: logging.StreamHandler

Stream handler to only log from the creating thread.

Overrides logging.StreamHandler to only allow logging to a stream from the thread that created the class instance and added to the root logger via log.addHandler(ThreadedStreamHandler(stream)).

This is used to pass log output from the specific test that creates this handler to stdout, either immediately or (when multiple threads are in use) at the end of each test’s execution.

__init__(strm)[source]

Overrides logging.StreamHandler.__init__.

emit(record)[source]

Overrides logging.StreamHandler.emit.

pysys.rootLogger = <Logger pysys (DEBUG)>

The root logger for all logging within PySys.

pysys.stdoutHandler = <ThreadedStreamHandler <stdout> (NOTSET)>

The default stdout logging handler for all logging within PySys.