Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: systrace/systrace/decorators.py

Issue 2295913002: Enable some profile_chrome unit tests on Trybots (Closed) Base URL: https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git@master
Patch Set: Add Chris as owner of Systrace bin directory Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « systrace/profile_chrome/profiler_unittest.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 4
5 5
6 def HostOnlyTest(func): 6 def HostOnlyTest(func):
7 """Decorator for running unit tests only on the host device. 7 """Decorator for running unit tests only on the host device.
8 8
9 This will disable unit tests from running on Android devices. 9 This will disable unit tests from running on Android devices.
10 """ 10 """
11 return _SkipTestDecoratorHelper(func, ['android']) 11 return _SkipTestDecoratorHelper(func, ['android'])
12 12
13 13
14 def ClientOnlyTest(func): 14 def ClientOnlyTest(func):
15 """Decorator for running unit tests only on client devices (Android). 15 """Decorator for running unit tests only on client devices (Android).
16 """ 16 """
17 return _SkipTestDecoratorHelper(func, ['windows', 'linux', 'mac']) 17 return _SkipTestDecoratorHelper(func, ['win', 'linux', 'mac'])
18
19
20 def Disabled(func):
21 """Decorator for not running a unit test on any Trybot platform.
22 """
23 return _SkipTestDecoratorHelper(func, ['win', 'linux', 'mac', 'android'])
18 24
19 25
20 def _SkipTestDecoratorHelper(func, disabled_strings): 26 def _SkipTestDecoratorHelper(func, disabled_strings):
21 if not hasattr(func, '_disabled_strings'): 27 if not hasattr(func, '_disabled_strings'):
22 setattr(func, '_disabled_strings', set(disabled_strings)) 28 setattr(func, '_disabled_strings', set(disabled_strings))
23 return func 29 return func
24 30
25 31
26 def ShouldSkip(test, device): 32 def ShouldSkip(test, device):
27 """Returns whether the test should be skipped and the reason for it.""" 33 """Returns whether the test should be skipped and the reason for it."""
28 if hasattr(test, '_disabled_strings'): 34 if hasattr(test, '_disabled_strings'):
29 disabled_devices = getattr(test, '_disabled_strings') 35 disabled_devices = getattr(test, '_disabled_strings')
30 return device in disabled_devices 36 return device in disabled_devices
31 return False 37 return False
OLDNEW
« no previous file with comments | « systrace/profile_chrome/profiler_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698