code: def test(testdir_from_ns, tags=[], setup_func=None):
      log.debug(
          "test(testdir_from_ns=%r, tags=%r, ...)",
          testdir_from_ns,
          tags,
      )
      if setup_func is not None:
          setup_func()
      tests = list(tests_from_manifest_and_tags(testdir_from_ns, tags))
      if not tests:
          return None
  
      # Groups test cases into a test suite class given by their test module's
      # "test_suite_class" hook, if any.
      suite = unittest.TestSuite()
      suite_for_testmod = None
      testmod = None
      for test in tests:
          if test.testmod != testmod:
              if suite_for_testmod is not None:
                  suite.addTest(suite_for_testmod)
              suite_for_testmod = (
                  test.testsuite_class or unittest.TestSuite
              )()
              testmod = test.testmod
          suite_for_testmod.addTest(test.testcase)
      if suite_for_testmod is not None:
          suite.addTest(suite_for_testmod)
  
      runner = ConsoleTestRunner(sys.stdout)
      result = runner.run(suite)
      return result
  
imports: import os
  from os.path import join, basename, abspath, splitext, isfile, isdir, normpath, exists
  import sys
  import getopt
  import glob
  import time
  import unittest
  import importlib
  import logging
  import textwrap
  import traceback
label_desc: Use image node_id 8 for calling a global function with example usage: test(testdir_from_ns, tags, setup_func) and returns: result, None