Internal Testing Modules

test.support

Shared utilities used by CPython tests, including output capture, resource-dependent skips and cleanup helpers. These support functions are internal; application tests can use contextlib.redirect_stdout and unittest instead. This is CPython test infrastructure, not a supported application dependency; prefer public unittest or standard-library equivalents in application tests.

Formal Syntax & Structure

python syntaxpython
import test.support

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
from test.support import captured_stdoutwith captured_stdout() as output:    print("ready")print(output.getvalue().strip())
Python Reference