test --- Regression tests package for Python — test.support --- Utilities for the Python test suite

synopsis: Support for Python's regression test suite.

The !test.support module provides support for Python's regression test suite.

!test.support is not a public module. It is documented here to help Python developers write tests. The API of this module is subject to change without backwards compatibility concerns between releases.

This module defines the following exceptions

Exception to be raised when a test fails. This is deprecated in favor of unittest\ -based tests and unittest.TestCase's assertion methods.

Subclass of unittest.SkipTest. Raised when a resource (such as a network connection) is not available. Raised by the requires function.

The !test.support module defines the following constants

True when verbose output is enabled. Should be checked when more detailed information is desired about a running test. verbose is set by test.regrtest.

True if the running interpreter is Jython.

True if sys.platform is android.

True if sys.platform is emscripten.

True if sys.platform is wasi.

True if sys.platform is ios, tvos, or watchos.

True if sys.platform is darwin or is_apple_mobile is True.

Path for shell if not on Windows; otherwise None.

Timeout in seconds for tests using a network server listening on the network local loopback interface like 127.0.0.1.

The timeout is long enough to prevent test failure: it takes into account that the client and the server can run in different threads or even different processes.

The timeout should be long enough for ~socket.socket.connect, ~socket.socket.recv and ~socket.socket.send methods of socket.socket.

Its default value is 10 seconds.

See also INTERNET_TIMEOUT.

Timeout in seconds for network requests going to the internet.

The timeout is short enough to prevent a test to wait for too long if the internet request is blocked for whatever reason.

Usually, a timeout using INTERNET_TIMEOUT should not mark a test as failed, but skip the test instead: see ~test.support.socket_helper.transient_internet.

Its default value is 1 minute.

See also LOOPBACK_TIMEOUT.

Timeout in seconds to mark a test as failed if the test takes "too long".

The timeout value depends on the regrtest --timeout command line option.

If a test using SHORT_TIMEOUT starts to fail randomly on slow buildbots, use LONG_TIMEOUT instead.

Its default value is 30 seconds.

Timeout in seconds to detect when a test hangs. …