OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 import logging | 4 import logging |
5 import unittest | 5 import unittest |
6 | 6 |
7 from telemetry.core import browser_options | 7 from telemetry.core import browser_options |
8 from telemetry.core import discover | 8 from telemetry.core import discover |
9 from telemetry.core import util | 9 from telemetry.core import util |
10 from telemetry.core.backends.chrome import cros_interface | 10 from telemetry.core.backends.chrome import cros_interface |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 return False | 63 return False |
64 | 64 |
65 if hasattr(test, '_testMethodName'): | 65 if hasattr(test, '_testMethodName'): |
66 method = getattr(test, test._testMethodName) # pylint: disable=W0212 | 66 method = getattr(test, test._testMethodName) # pylint: disable=W0212 |
67 if hasattr(method, '_requires_browser_types'): | 67 if hasattr(method, '_requires_browser_types'): |
68 types = method._requires_browser_types # pylint: disable=W0212 | 68 types = method._requires_browser_types # pylint: disable=W0212 |
69 if options_for_unittests.GetBrowserType() not in types: | 69 if options_for_unittests.GetBrowserType() not in types: |
70 logging.debug('Skipping test %s because it requires %s' % | 70 logging.debug('Skipping test %s because it requires %s' % |
71 (test.id(), types)) | 71 (test.id(), types)) |
72 return False | 72 return False |
73 if hasattr(method, '_disabled_test'): | 73 |
74 if not run_disabled_tests: | 74 if (not run_disabled_tests and |
75 return False | 75 (hasattr(method, '_disabled_test') or |
76 if (hasattr(method, '_disabled_test_on_cros') and | 76 (hasattr(method, '_disabled_test_on_cros') and |
77 cros_interface.IsRunningOnCrosDevice()): | 77 cros_interface.IsRunningOnCrosDevice()))): |
78 return False | 78 return False |
79 | 79 |
80 return True | 80 return True |
81 | 81 |
82 filtered_suite = FilterSuite(suite, IsTestSelected) | 82 filtered_suite = FilterSuite(suite, IsTestSelected) |
83 test_result = runner.run(filtered_suite) | 83 test_result = runner.run(filtered_suite) |
84 return test_result | 84 return test_result |
85 | 85 |
86 | 86 |
87 def RestoreLoggingLevel(func): | 87 def RestoreLoggingLevel(func): |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 default_options.run_test_repeat_count): # pylint: disable=E1101 | 143 default_options.run_test_repeat_count): # pylint: disable=E1101 |
144 success = success and DiscoverAndRunTests( | 144 success = success and DiscoverAndRunTests( |
145 start_dir, args, top_level_dir, | 145 start_dir, args, top_level_dir, |
146 runner, default_options.run_disabled_tests) | 146 runner, default_options.run_disabled_tests) |
147 if success: | 147 if success: |
148 return 0 | 148 return 0 |
149 finally: | 149 finally: |
150 options_for_unittests.Set(None, None) | 150 options_for_unittests.Set(None, None) |
151 | 151 |
152 return 1 | 152 return 1 |
OLD | NEW |