pysys.constants

Standard constants that are used throughout the PySys framework.

The convention is to import all contents of the module so that the constants can be referenced directly.

HOSTNAME

pysys.constants.HOSTNAME = 'localhost'

The fully qualified name of this host.

PLATFORM

pysys.constants.PLATFORM = 'linux'

OS platform - current values are: linux, win32 (Windows), sunos (Solaris), darwin (Mac). It is recommended to use standard Python functions such as sys.platform rather than this constant.

IS_WINDOWS

pysys.constants.IS_WINDOWS = False

True if this is Windows, False for other operating systems such as Unix.

PYTHON_EXE

pysys.constants.PYTHON_EXE = '/home/travis/virtualenv/python3.8.0/bin/python3.8'

The path to the current Python executable (=``sys.executable``).

BACKGROUND

pysys.constants.BACKGROUND = 10

Constant indicating a process is to be started asynchronously in the background.

FOREGROUND

pysys.constants.FOREGROUND = 11

Constant indicating a process is to be run synchronously in the foreground.

PASSED

pysys.constants.PASSED = PASSED(non-failure)

Non-failure test Outcome indicating successful validation steps.

INSPECT

pysys.constants.INSPECT = INSPECT(non-failure)

Non-failure test Outcome indicating that manual inspection of the test output is required (in addition to any automated checks).

NOTVERIFIED

pysys.constants.NOTVERIFIED = NOTVERIFIED(non-failure)

Non-failure test Outcome indicating that it was not possible to positively validate correct operation. This is not treated as a failure outcome.

FAILED

pysys.constants.FAILED = FAILED

Failure test Outcome indicating validation steps with a negative outcome.

TIMEDOUT

pysys.constants.TIMEDOUT = TIMEDOUT

Failure test Outcome indicating that the test timed out while performing execution or validation operations.

DUMPEDCORE

pysys.constants.DUMPEDCORE = DUMPEDCORE

Failure test Outcome indicating that a crash occurred, and a core file was generated (UNIX only).

BLOCKED

pysys.constants.BLOCKED = BLOCKED

Failure test Outcome indicating that something went wrong, for example an exception was raised by the testcase or a required file could not be found.

SKIPPED

pysys.constants.SKIPPED = SKIPPED(non-failure)

Non-failure test Outcome indicating that the test was ignored as it is not currently required to run on this platform/mode. See pysys.basetest.BaseTest.skipTest.

OUTCOMES

pysys.constants.OUTCOMES = (SKIPPED(non-failure), BLOCKED, DUMPEDCORE, TIMEDOUT, FAILED, NOTVERIFIED(non-failure), INSPECT(non-failure), PASSED(non-failure))

Lists all possible test outcomes, in descending order of precedence.

SKIPPED

Non-failure test Outcome indicating that the test was ignored as it is not currently required to run on this platform/mode.

BLOCKED

Failure test Outcome indicating that something went wrong, for example an exception was raised by the testcase or a required file could not be found.

DUMPEDCORE

Failure test Outcome indicating that a crash occurred, and a core file was generated (UNIX only).

TIMEDOUT

Failure test Outcome indicating that the test timed out while performing execution or validation operations.

FAILED

Failure test Outcome indicating validation steps with a negative outcome.

NOTVERIFIED

Non-failure test Outcome indicating that it was not possible to positively validate correct operation.

INSPECT

Non-failure test Outcome indicating that manual inspection of the test output is required (in addition to any automated checks).

PASSED

Non-failure test Outcome indicating successful validation steps.

If a test adds multiple outcomes, the outcome with highest precedence is used as the final test outcome (i.e. SKIPPED rather than FAILED, FAILED rather than PASSED etc).

Each item is an instance of Outcome. Use Outcome.isFailure() to check whether a given outcome is classed as a failure for reporting purposes.

PRECEDENT

pysys.constants.PRECEDENT = (SKIPPED(non-failure), BLOCKED, DUMPEDCORE, TIMEDOUT, FAILED, NOTVERIFIED(non-failure), INSPECT(non-failure), PASSED(non-failure))
Deprecated

The old name for OUTCOMES.

FAILS

pysys.constants.FAILS = [BLOCKED, DUMPEDCORE, TIMEDOUT, FAILED]
Deprecated

To test whether a specific outcome from OUTCOMES is a failure, use Outcome.isFailure().

LOOKUP

pysys.constants.LOOKUP = {SKIPPED(non-failure): 'SKIPPED', BLOCKED: 'BLOCKED', DUMPEDCORE: 'DUMPED CORE', TIMEDOUT: 'TIMED OUT', FAILED: 'FAILED', NOTVERIFIED(non-failure): 'NOT VERIFIED', INSPECT(non-failure): 'REQUIRES INSPECTION', PASSED(non-failure): 'PASSED', True: 'TRUE', False: 'FALSE'}

Lookup dictionary providing the string representation of test outcomes. :deprecated: Use str(outcome) on the Outcome to convert to the display name.

DEFAULT_TIMEOUT

pysys.constants.DEFAULT_TIMEOUT = 600

Deprecated: Use a specific member of TIMEOUTS instead.

TIMEOUTS

pysys.constants.TIMEOUTS = {'ManualTester': 1800, 'WaitForAvailableTCPPort': 300, 'WaitForFile': 30, 'WaitForProcess': 600, 'WaitForProcessStop': 30, 'WaitForSignal': 60, 'WaitForSocket': 60}

Default timeouts used for various operations.

Each timeout is given as a floating point number of seconds.

These timeouts can be customized from a runner plugin (or pysys.baserunner.BaseRunner.setup()) if needed (but never change them from within individual testcases).

Outcome

class pysys.constants.Outcome(id, isFailure, displayName=None)[source]

Bases: object

Represents a PySys test outcome that can be reported using pysys.basetest.BaseTest.addOutcome().

The possible outcomes are listed in OUTCOMES.

Use str() or %s to get the display name for an outcome (e.g. “TIMED OUT”), and isFailure() to check if it’s a failure outcome.

isFailure()[source]
Return bool

True if this outcome is classed as failure, or False if not (e.g. SKIPPED and NOTVERIFIED are not failures).

PrintLogs

class pysys.constants.PrintLogs[source]

Bases: enum.Enum

Enumeration constants that specify when run.log contents are printed to the stdout console.

In all cases a summary of failures is printed at the end, and the user can always look at the run.log inside each output directory if they need more detail.

NONE = 'PrintLogs.NONE'

Detailed run.log output is not printed to the stdout console.

ALL = 'PrintLogs.ALL'

Detailed run.log output is always printed to the stdout console, for both passed and failed testcases.

FAILURES = 'PrintLogs.FAILURES'

Detailed run.log output is only printed to the stdout console for failed testcases.