Upstream version 10.38.222.0
[platform/framework/web/crosswalk.git] / src / tools / swarming_client / tests / trace_test_util.py
1 # Copyright 2013 The Swarming Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 that
3 # can be found in the LICENSE file.
4
5 import functools
6 import os
7 import sys
8
9 TESTS_DIR = os.path.dirname(os.path.abspath(__file__))
10 sys.path.insert(0, os.path.dirname(TESTS_DIR))
11
12 import trace_inputs
13
14
15 def check_can_trace(fn):
16   """Function decorator that skips test that need to be able trace."""
17   @functools.wraps(fn)
18   def hook(self, *args, **kwargs):
19     if not trace_inputs.can_trace():
20       self.fail('Please rerun this test with admin privileges.')
21     return fn(self, *args, **kwargs)
22   return hook