def test_no_tests_found(self): tester = Tester() errors = StringIO.StringIO() # Here we need to remove any existing log handlers so that they # don't log the messages webkitpy.test while we're testing it. root_logger = logging.getLogger() root_handlers = root_logger.handlers root_logger.handlers = [] tester.printer.stream = errors tester.finder.find_names = lambda args, run_all: [] oc = OutputCapture() orig_argv = sys.argv[:] try: sys.argv = sys.argv[0:1] oc.capture_output() self.assertFalse(tester.run()) finally: _, _, logs = oc.restore_output() root_logger.handlers = root_handlers sys.argv = orig_argv self.assertIn('No tests to run', errors.getvalue()) self.assertIn('No tests to run', logs)
def test_no_tests_found(self): tester = Tester() errors = StringIO() # Here we need to remove any existing log handlers so that they # don't log the messages webkitpy.test while we're testing it. root_logger = logging.getLogger() root_handlers = root_logger.handlers root_logger.handlers = [] tester.printer.stream = errors tester.finder.find_names = lambda args, run_all: [] with OutputCapture(level=logging.INFO) as captured: self.assertFalse(tester.run()) root_logger.handlers = root_handlers self.assertIn('No tests to run', errors.getvalue()) self.assertIn('No tests to run', captured.root.log.getvalue())
def test_no_tests_found(self): tester = Tester() errors = StringIO.StringIO() # Here we need to remove any existing log handlers so that they # don't log the messages webkitpy.test while we're testing it. root_logger = logging.getLogger() root_handlers = root_logger.handlers root_logger.handlers = [] tester.stream = errors tester.finder.find_names = lambda args, skip_integration, run_all: [] oc = OutputCapture() try: oc.capture_output() self.assertFalse(tester.run()) finally: out, err, logs = oc.restore_output() root_logger.handlers = root_handlers self.assertTrue('No tests to run' in errors.getvalue()) self.assertTrue('No tests to run' in logs)
def _find_test_names(self, args): tester = Tester() tester._options, args = tester._parse_args(args) return tester._test_names(_Loader(), args)
def test_individual_names_are_not_run_twice(self): tester = Tester() tester._options, args = tester._parse_args(["webkitpy.test.main_unittest.TesterTest.test_no_tests_found"]) parallel_tests, serial_tests = tester._test_names(_Loader(), args) self.assertEquals(parallel_tests, args) self.assertEquals(serial_tests, [])