def run_module(self, mod):
        """Run a test module.

        Prepares the configuration with module configuration, sends report
        messages appropriate for modules, and reports pass or fail.

        Arguments:
            mod:
                A module object with a run() function that takes a configuration
                object as it's single parameter.

        Returns:
            The return value of the module's Run() function, or FAILED if the
            module raised an exception.
        """
        cf = self.config
        # make the module look like a test.
        mod.test_name = mod.__name__
        ID = get_module_version(mod)
        cf.report.add_message("MODULEVERSION", ID)
        cf.report.add_message("USECASESTARTTIME", timelib.now())
        try:
            rv = self.run_object(mod)
        except KeyboardInterrupt:
            cf.report.add_message("MODULEENDTIME", timelib.now())
            cf.report.incomplete("Module aborted by user.")
            raise
        except:
            ex, val, tb = sys.exc_info()
            if cf.flags.DEBUG:
                from pycopia import debugger
                debugger.post_mortem(tb, ex, val)
            rv = constants.FAILED
            cf.report.add_message("MODULEENDTIME", timelib.now())
            cf.report.failed("Module exception: %s (%s)" % (ex, val))
        else:
            cf.report.add_message("MODULEENDTIME", timelib.now())
            if rv is None:
                # If module run() function returns None we take that to mean that
                # it runs a TestSuite itself. Report PASSED value.
                return 1
            elif type(rv) is core.TestResult:
                return bool(rv)
            # If the module returns something else we take that to mean that
            # it is reporting some true/false value to report as pass/fail.
            elif rv:
                return cf.report.passed("Return evaluates True.")
            else:
                return cf.report.failed("Return evaluates False.")
dataset/ETHPy150Open kdart/pycopia/QA/pycopia/QA/testrunner.py/TestRunner.run_module/original