def test(self, options):
        if not options.capabilities.intersection(self.capabilities):
            return

        options.log.info('Testing %s.', self)
        if options.pretend:
            return

        module = None
        try:
            module = self.get_module(options.test_root)
        except __HOLE__:
            options.log.warning('No test exists for %s', self)
        except Exception:
            options.log.exception('Cannot load test for %s', self)
        if not module:
            return

        module_interactive = options.interactive
        if hasattr(module, '__noninteractive') and \
           getattr(module, '__noninteractive'):
            module_interactive = False

        if options.regression_check and \
           os.path.exists(self.get_regression_image_filename()):
            result = RegressionCheckTestResult(
                self, options.regression_tolerance)
            module_interactive = False
        elif options.regression_capture:
            result = RegressionCaptureTestResult(self)
        else:
            result = StandardTestResult(self)

        print ("Running Test: %s" % self)
        if module.__doc__:
            print module.__doc__
        print '-' * 78
        if module_interactive:
            raw_input('Press return to begin test...')


        suite = unittest.TestLoader().loadTestsFromModule(module)

        options.log.info('Begin unit tests for %s', self)
        suite(result)
        for failure in result.failures:
            options.log.error('Failure in %s', self)
            options.log.error(failure[1])
        for error in result.errors:
            options.log.error('Error in %s', self)
            options.log.error(error[1])
        options.log.info('%d tests run', result.testsRun)

        if (module_interactive and 
            len(result.failures) == 0 and 
            len(result.errors) == 0):
            print module.__doc__
            user_result = raw_input('[P]assed test, [F]ailed test: ')
            if user_result and user_result[0] in ('F', 'f'):
                print 'Enter failure description: '
                description = raw_input('> ')
                options.log.error('User marked fail for %s', self)
                options.log.error(description)
            else:
                options.log.info('User marked pass for %s', self)
                result.setUserPass()
dataset/ETHPy150Open ardekantur/pyglet/tests/test.py/TestCase.test