code: def run_iptestall(options):
      """Run the entire IPython test suite by calling nose and trial.
  
      This function constructs :class:`IPTester` instances for all IPython
      modules and package and then runs each of them.  This causes the modules
      and packages of IPython to be tested each in their own subprocess using
      nose.
  
      Parameters
      ----------
  
      All parameters are passed as attributes of the options object.
  
      testgroups : list of str
        Run only these sections of the test suite. If empty, run all the available
        sections.
  
      fast : int or None
        Run the test suite in parallel, using n simultaneous processes. If None
        is passed, one process is used per CPU core. Default 1 (i.e. sequential)
  
      inc_slow : bool
        Include slow tests. By default, these tests aren't run.
  
      url : unicode
        Address:port to use when running the JS tests.
  
      xunit : bool
        Produce Xunit XML output. This is written to multiple foo.xunit.xml files.
  
      coverage : bool or str
        Measure code coverage from tests. True will store the raw coverage data,
        or pass 'html' or 'xml' to get reports.
  
      extra_args : list
        Extra arguments to pass to the test subprocesses, e.g. '-v'
      """
      to_run, not_run = prepare_controllers(options)
  
      def justify(ltext, rtext, width=70, fill="-"):
          ltext += " "
          rtext = (" " + rtext).rjust(width - len(ltext), fill)
          return ltext + rtext
  
      # Run all test runners, tracking execution time
      failed = []
      t_start = time.time()
  
      print()
      if options.fast == 1:
          # This actually means sequential, i.e. with 1 job
          for controller in to_run:
              print("Test group:", controller.section)
              sys.stdout.flush()  # Show in correct order when output is piped
              controller, res = do_run(controller, buffer_output=False)
              if res:
                  failed.append(controller)
                  if res == -signal.SIGINT:
                      print("Interrupted")
                      break
              print()
  
      else:
          # Run tests concurrently
          try:
              pool = multiprocessing.pool.ThreadPool(options.fast)
              for controller, res in pool.imap_unordered(
                  do_run, to_run
              ):
                  res_string = "OK" if res == 0 else "FAILED"
                  print(
                      justify(
                          "Test group: " + controller.section,
                          res_string,
                      )
                  )
                  if res:
                      controller.print_extra_info()
                      print(bytes_to_str(controller.stdout))
                      failed.append(controller)
                      if res == -signal.SIGINT:
                          print("Interrupted")
                          break
          except KeyboardInterrupt:
              return
  
      for controller in not_run:
          print(justify("Test group: " + controller.section, "NOT RUN"))
  
      t_end = time.time()
      t_tests = t_end - t_start
      nrunners = len(to_run)
      nfail = len(failed)
      # summarize results
      print("_" * 70)
      print(
          "Test suite completed for system with the following information:"
      )
      print(report())
      took = "Took %.3fs." % t_tests
      print("Status: ", end="")
      if not failed:
          print("OK (%d test groups)." % nrunners, took)
      else:
          # If anything went wrong, point out what command to rerun manually to
          # see the actual errors and individual summary
          failed_sections = [c.section for c in failed]
          print(
              "ERROR - {} out of {} test groups failed ({}).".format(
                  nfail, nrunners, ", ".join(failed_sections)
              ),
              took,
          )
          print()
          print("You may wish to rerun these, with:")
          print("  iptest", *failed_sections)
          print()
  
      if options.coverage:
          from coverage import coverage, CoverageException
  
          cov = coverage(data_file=".coverage")
          cov.combine()
          cov.save()
  
          # Coverage HTML report
          if options.coverage == "html":
              html_dir = "ipy_htmlcov"
              shutil.rmtree(html_dir, ignore_errors=True)
              print(
                  "Writing HTML coverage report to %s/ ... " % html_dir,
                  end="",
              )
              sys.stdout.flush()
  
              # Custom HTML reporter to clean up module names.
              from coverage.html import HtmlReporter
  
              class CustomHtmlReporter(HtmlReporter):
                  def find_code_units(self, morfs):
                      super(CustomHtmlReporter, self).find_code_units(
                          morfs
                      )
                      for cu in self.code_units:
                          nameparts = cu.name.split(os.sep)
                          if "IPython" not in nameparts:
                              continue
                          ix = nameparts.index("IPython")
                          cu.name = ".".join(nameparts[ix:])
  
              # Reimplement the html_report method with our custom reporter
              cov.get_data()
              cov.config.from_args(
                  omit="*{0}tests{0}*".format(os.sep),
                  html_dir=html_dir,
                  html_title="IPython test coverage",
              )
              reporter = CustomHtmlReporter(cov, cov.config)
              reporter.report(None)
              print("done.")
  
          # Coverage XML report
          elif options.coverage == "xml":
              try:
                  cov.xml_report(outfile="ipy_coverage.xml")
              except CoverageException as e:
                  print(
                      "Generating coverage report failed. Are you running javascript tests only?"
                  )
                  import traceback
  
                  traceback.print_exc()
  
      if failed:
          # Ensure that our exit code indicates failure
          sys.exit(1)
  
imports: from __future__ import print_function
  import argparse
  import json
  import multiprocessing.pool
  import os
  import stat
  import re
  import requests
  import shutil
  import signal
  import sys
  import subprocess
  import time
  from .iptest import have, test_group_names, test_sections, StreamCapturer, test_for
  from IPython.utils.path import compress_user
  from IPython.utils.py3compat import bytes_to_str
  from IPython.utils.sysinfo import get_sys_info
  from IPython.utils.tempdir import TemporaryDirectory
  from IPython.utils.text import strip_ansi
label_desc: Use image node_id 4 for calling a global function with example usage: run_iptestall(options) and returns: unknown