| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import argparse | 5 import argparse |
| 6 import json | 6 import json |
| 7 import os | 7 import os |
| 8 import sys | 8 import sys |
| 9 import time | 9 import time |
| 10 import unittest | 10 import unittest |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 return 2 | 44 return 2 |
| 45 | 45 |
| 46 chromium_src_dir = os.path.join(os.path.dirname(__file__), | 46 chromium_src_dir = os.path.join(os.path.dirname(__file__), |
| 47 os.pardir, | 47 os.pardir, |
| 48 os.pardir, | 48 os.pardir, |
| 49 os.pardir) | 49 os.pardir) |
| 50 | 50 |
| 51 loader = unittest.loader.TestLoader() | 51 loader = unittest.loader.TestLoader() |
| 52 print "Running Python unit tests under %s..." % self._test_dir | 52 print "Running Python unit tests under %s..." % self._test_dir |
| 53 | 53 |
| 54 pylib_dir = os.path.join(chromium_src_dir, self._test_dir) | 54 pylib_dir = os.path.abspath(os.path.join(chromium_src_dir, self._test_dir)) |
| 55 if args.tests: | 55 if args.tests: |
| 56 if pylib_dir not in sys.path: | 56 if pylib_dir not in sys.path: |
| 57 sys.path.append(pylib_dir) | 57 sys.path.append(pylib_dir) |
| 58 suite = unittest.TestSuite() | 58 suite = unittest.TestSuite() |
| 59 for test_name in args.tests: | 59 for test_name in args.tests: |
| 60 suite.addTests(loader.loadTestsFromName(test_name)) | 60 suite.addTests(loader.loadTestsFromName(test_name)) |
| 61 else: | 61 else: |
| 62 suite = loader.discover(pylib_dir, pattern='*_unittest.py') | 62 suite = loader.discover(pylib_dir, pattern='*_unittest.py') |
| 63 | 63 |
| 64 runner = unittest.runner.TextTestRunner(verbosity=(args.verbose + 1)) | 64 runner = unittest.runner.TextTestRunner(verbosity=(args.verbose + 1)) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 | 139 |
| 140 def _AddPathToTrie(trie, path, value): | 140 def _AddPathToTrie(trie, path, value): |
| 141 if TEST_SEPARATOR not in path: | 141 if TEST_SEPARATOR not in path: |
| 142 trie[path] = value | 142 trie[path] = value |
| 143 return | 143 return |
| 144 directory, rest = path.split(TEST_SEPARATOR, 1) | 144 directory, rest = path.split(TEST_SEPARATOR, 1) |
| 145 if directory not in trie: | 145 if directory not in trie: |
| 146 trie[directory] = {} | 146 trie[directory] = {} |
| 147 _AddPathToTrie(trie[directory], rest, value) | 147 _AddPathToTrie(trie[directory], rest, value) |
| OLD | NEW |