Internal Testing Modules

test.support.script_helper

Fixtures for testing interpreter invocation and scripts. Helpers can create scripts and launch Python child processes to inspect exit status and streams. This example creates a temporary script without executing it; never run untrusted source through these helpers. 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.script_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.script_helper import make_scriptfrom tempfile import TemporaryDirectoryfrom pathlib import Pathwith TemporaryDirectory() as folder:    path = make_script(folder, "demo", "value = 7\n")    print(Path(path).name)
Python Reference