code: def run_test_script(script):
      # use -u to try to get the full output if the test hangs or crash
      if support.verbose:
  
          def title(text):
              return f"===== {text} ======"
  
          name = f"script {os.path.basename(script)}"
          print()
          print(title(name), flush=True)
          # In verbose mode, the child process inherit stdout and stdout,
          # to see output in realtime and reduce the risk of losing output.
          args = [
              sys.executable,
              "-E",
              "-X",
              "faulthandler",
              "-u",
              script,
              "-v",
          ]
          proc = subprocess.run(args)
          print(
              title(f"{name} completed: exit code {proc.returncode}"),
              flush=True,
          )
          if proc.returncode:
              raise AssertionError(f"{name} failed")
      else:
          assert_python_ok("-u", script, "-v")
  
imports: import collections
  import importlib
  import sys
  import os
  import os.path
  import subprocess
  import py_compile
  from importlib.util import source_from_cache
  from test import support
  from test.support.import_helper import make_legacy_pyc
label_desc: Use image node_id 12 for calling a global function with example usage: run_test_script(script) and returns: str, text, str