Internal Testing Modules

test.support.import_helper

Helpers for import-related interpreter tests, including importing optional dependencies and managing temporary module state. import_module can skip a test if a module cannot be imported. Import operations may execute module code; use known trusted names. 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.import_helper

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_helper import import_modulemodule = import_module("math")print(module.isqrt(49))
Python Reference