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 = 'aiv-win2019.eur.ad.sag'

The fully qualified name of this host.

PLATFORM

pysys.constants.PLATFORM = 'win32'

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.

PREFERRED_ENCODING

pysys.constants.PREFERRED_ENCODING = 'cp1252'

The operating system’s preferred/default encoding for reading/writing the contents of text data in files and process stdout/stderr for the current environment (or machine).

This returns the same value as Python’s locale.getpreferredencoding() method, but as that method is not thread-safe, this constant must always be used in test cases to avoid race conditions when running tests in parallel.

The OS preferred encoding should not be confused with Python’s ‘default’ encoding (sys.getdefaultencoding()) which is usually not relevant for testing purposes.

See also pysys.basetest.BaseTest.getDefaultFileEncoding().

New in version 2.0.

IS_WINDOWS

pysys.constants.IS_WINDOWS = True

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

PYTHON_EXE

pysys.constants.PYTHON_EXE = 'c:\\apama_build\\br\\rel\\10.15.1.x\\apama-lib5\\win\\amd64\\all\\python\\3.9.5\\python.exe'

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

EXE_SUFFIX

pysys.constants.EXE_SUFFIX = '.exe'

The suffix added to binary executables, that is .exe on Windows, and empty string on Unix.

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.

BADPERF

pysys.constants.BADPERF = BADPERF

Failure test Outcome indicating that the measured performance (speed, memory use, etc) was deemed insufficient. When using this outcome, it is always best to also report the underlying numeric values using pysys.basetest.BaseTest.reportPerformanceResult to provide a record of how close to the limit the performance has been historically. Note that until other failure outcomes, the BADPERF outcome will not prevent reportPerformanceResult from recording subsequent results.

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, BADPERF, 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.

BADPERF

Failure test Outcome indicating that the measured performance (speed, memory use, etc) was deemed insufficient.

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, and 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, BADPERF, NOTVERIFIED(non-failure), INSPECT(non-failure), PASSED(non-failure))
Deprecated

The old name for OUTCOMES.

FAILS

pysys.constants.FAILS = [BLOCKED, DUMPEDCORE, TIMEDOUT, FAILED, BADPERF]
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', BADPERF: 'BAD PERFORMANCE', 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.

OSWALK_IGNORES

pysys.constants.OSWALK_IGNORES = ['.git', '.svn', '__pycache__', 'CVS']

A list of directory names to exclude when recursively walking a directory tree.

This is used by PySys during test loading, and can also be used for subsequent directory walking operations.

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(value)[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.