OLD | NEW |
1 # Copyright (C) 2012 Google, Inc. | 1 # Copyright (C) 2012 Google, Inc. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions | 4 # modification, are permitted provided that the following conditions |
5 # are met: | 5 # are met: |
6 # 1. Redistributions of source code must retain the above copyright | 6 # 1. Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # 2. Redistributions in binary form must reproduce the above copyright | 8 # 2. Redistributions in binary form must reproduce the above copyright |
9 # notice, this list of conditions and the following disclaimer in the | 9 # notice, this list of conditions and the following disclaimer in the |
10 # documentation and/or other materials provided with the distribution. | 10 # documentation and/or other materials provided with the distribution. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 # Here we need to remove any existing log handlers so that they | 57 # Here we need to remove any existing log handlers so that they |
58 # don't log the messages webkitpy.test while we're testing it. | 58 # don't log the messages webkitpy.test while we're testing it. |
59 root_logger = logging.getLogger() | 59 root_logger = logging.getLogger() |
60 root_handlers = root_logger.handlers | 60 root_handlers = root_logger.handlers |
61 root_logger.handlers = [] | 61 root_logger.handlers = [] |
62 | 62 |
63 tester.printer.stream = errors | 63 tester.printer.stream = errors |
64 tester.finder.find_names = lambda args, run_all: [] | 64 tester.finder.find_names = lambda args, run_all: [] |
65 oc = OutputCapture() | 65 oc = OutputCapture() |
| 66 orig_argv = sys.argv[:] |
66 try: | 67 try: |
| 68 sys.argv = sys.argv[0:1] |
67 oc.capture_output() | 69 oc.capture_output() |
68 self.assertFalse(tester.run()) | 70 self.assertFalse(tester.run()) |
69 finally: | 71 finally: |
70 _, _, logs = oc.restore_output() | 72 _, _, logs = oc.restore_output() |
71 root_logger.handlers = root_handlers | 73 root_logger.handlers = root_handlers |
| 74 sys.argv = orig_argv |
72 | 75 |
73 self.assertIn('No tests to run', errors.getvalue()) | 76 self.assertIn('No tests to run', errors.getvalue()) |
74 self.assertIn('No tests to run', logs) | 77 self.assertIn('No tests to run', logs) |
75 | 78 |
76 def _find_test_names(self, args): | 79 def _find_test_names(self, args): |
77 tester = Tester() | 80 tester = Tester() |
78 tester._options, args = tester._parse_args(args) | 81 tester._options, args = tester._parse_args(args) |
79 return tester._test_names(_Loader(), args) | 82 return tester._test_names(_Loader(), args) |
80 | 83 |
81 def test_individual_names_are_not_run_twice(self): | 84 def test_individual_names_are_not_run_twice(self): |
(...skipping 26 matching lines...) Expand all Loading... |
108 filesystem = FileSystem() | 111 filesystem = FileSystem() |
109 executive = Executive() | 112 executive = Executive() |
110 module_path = filesystem.path_to_module(self.__module__) | 113 module_path = filesystem.path_to_module(self.__module__) |
111 script_dir = module_path[0:module_path.find('webkitpy') - 1] | 114 script_dir = module_path[0:module_path.find('webkitpy') - 1] |
112 proc = executive.popen([sys.executable, filesystem.join(script_dir, 'tes
t-webkitpy'), '-c', STUBS_CLASS + '.test_empty'], | 115 proc = executive.popen([sys.executable, filesystem.join(script_dir, 'tes
t-webkitpy'), '-c', STUBS_CLASS + '.test_empty'], |
113 stdout=executive.PIPE, stderr=executive.PIPE) | 116 stdout=executive.PIPE, stderr=executive.PIPE) |
114 out, _ = proc.communicate() | 117 out, _ = proc.communicate() |
115 retcode = proc.returncode | 118 retcode = proc.returncode |
116 self.assertEqual(retcode, 0) | 119 self.assertEqual(retcode, 0) |
117 self.assertIn('Cover', out) | 120 self.assertIn('Cover', out) |
OLD | NEW |