code: def run_iptest():
      """Run the IPython test suite using nose.
  
      This function is called when this script is **not** called with the form
      `iptest all`.  It simply calls nose with appropriate command line flags
      and accepts all of the standard nose arguments.
      """
      # Apply our monkeypatch to Xunit
      if "--with-xunit" in sys.argv and not hasattr(
          Xunit, "orig_addError"
      ):
          monkeypatch_xunit()
  
      arg1 = sys.argv[1]
      if arg1 in test_sections:
          section = test_sections[arg1]
          sys.argv[1:2] = section.includes
      elif arg1.startswith("IPython.") and arg1[8:] in test_sections:
          section = test_sections[arg1[8:]]
          sys.argv[1:2] = section.includes
      else:
          section = TestSection(arg1, includes=[arg1])
  
      argv = sys.argv + [
          "--detailed-errors",  # extra info in tracebacks
          # We add --exe because of setuptools' imbecility (it
          # blindly does chmod +x on ALL files).  Nose does the
          # right thing and it tries to avoid executables,
          # setuptools unfortunately forces our hand here.  This
          # has been discussed on the distutils list and the
          # setuptools devs refuse to fix this problem!
          "--exe",
      ]
      if "-a" not in argv and "-A" not in argv:
          argv = argv + ["-a", "!crash"]
  
      if nose.__version__ >= "0.11":
          # I don't fully understand why we need this one, but depending on what
          # directory the test suite is run from, if we don't give it, 0 tests
          # get run.  Specifically, if the test suite is run from the source dir
          # with an argument (like 'iptest.py IPython.core', 0 tests are run,
          # even if the same call done in this directory works fine).  It appears
          # that if the requested package is in the current dir, nose bails early
          # by default.  Since it's otherwise harmless, leave it in by default
          # for nose >= 0.11, though unfortunately nose 0.10 doesn't support it.
          argv.append("--traverse-namespace")
  
      plugins = [
          ExclusionPlugin(section.excludes),
          KnownFailure(),
          SubprocessStreamCapturePlugin(),
      ]
  
      # we still have some vestigial doctests in core
      if section.name.startswith(("core", "IPython.core")):
          plugins.append(IPythonDoctest())
          argv.extend(
              [
                  "--with-ipdoctest",
                  "--ipdoctest-tests",
                  "--ipdoctest-extension=txt",
              ]
          )
  
      # Use working directory set by parent process (see iptestcontroller)
      if "IPTEST_WORKING_DIR" in os.environ:
          os.chdir(os.environ["IPTEST_WORKING_DIR"])
  
      # We need a global ipython running in this process, but the special
      # in-process group spawns its own IPython kernels, so for *that* group we
      # must avoid also opening the global one (otherwise there's a conflict of
      # singletons).  Ultimately the solution to this problem is to refactor our
      # assumptions about what needs to be a singleton and what doesn't (app
      # objects should, individual shells shouldn't).  But for now, this
      # workaround allows the test suite for the inprocess module to complete.
      if "kernel.inprocess" not in section.name:
          from IPython.testing import globalipapp
  
          globalipapp.start_ipython()
  
      # Now nose can run
      TestProgram(argv=argv, addplugins=plugins)
  
imports: from __future__ import print_function
  import glob
  from io import BytesIO
  import os
  import os.path
  import sys
  from threading import Thread, Lock, Event
  import warnings
  import nose.plugins.builtin
  from nose.plugins.xunit import Xunit
  from nose import SkipTest
  from nose.core import TestProgram
  from nose.plugins import Plugin
  from nose.util import safe_str
  from IPython import version_info
  from IPython.utils.py3compat import bytes_to_str
  from IPython.utils.importstring import import_item
  from IPython.testing.plugin.ipdoctest import IPythonDoctest
  from IPython.external.decorators import KnownFailure, knownfailureif
label_desc: Use image node_id 5 for calling a global function with example usage: run_iptest() without return types