OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Swarming Authors. All rights reserved. | 2 # Copyright 2014 The Swarming Authors. All rights reserved. |
3 # Use of this source code is governed by the Apache v2.0 license that can be | 3 # Use of this source code is governed by the Apache v2.0 license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import sys | 8 import sys |
9 import unittest | 9 import unittest |
10 | 10 |
11 ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | 11 ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
12 sys.path.insert(0, ROOT_DIR) | 12 sys.path.insert(0, ROOT_DIR) |
13 | 13 |
14 import test_env | 14 import test_env |
15 | |
16 test_env.setup_test_env() | 15 test_env.setup_test_env() |
17 | 16 |
| 17 from test_support import test_case |
| 18 |
18 from server import stats | 19 from server import stats |
19 from support import test_case | |
20 | 20 |
21 | 21 |
22 # pylint: disable=W0212 | 22 # pylint: disable=W0212 |
23 | 23 |
24 | 24 |
25 class StatsPrivateTest(test_case.TestCase): | 25 class StatsPrivateTest(test_case.TestCase): |
26 def _gen_data(self): | 26 def _gen_data(self): |
27 dimensions = {'os': 'Amiga', 'hostname': 'host3'} | 27 dimensions = {'os': 'Amiga', 'hostname': 'host3'} |
28 # Description of the log entries: | 28 # Description of the log entries: |
29 # - host3 is idle | 29 # - host3 is idle |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 self.assertEqual(expected, [i.dimensions for i in snapshot.buckets]) | 221 self.assertEqual(expected, [i.dimensions for i in snapshot.buckets]) |
222 self.assertEqual(0, len(snapshot.users)) | 222 self.assertEqual(0, len(snapshot.users)) |
223 | 223 |
224 | 224 |
225 if __name__ == '__main__': | 225 if __name__ == '__main__': |
226 logging.basicConfig( | 226 logging.basicConfig( |
227 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR) | 227 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR) |
228 if '-v' in sys.argv: | 228 if '-v' in sys.argv: |
229 unittest.TestCase.maxDiff = None | 229 unittest.TestCase.maxDiff = None |
230 unittest.main() | 230 unittest.main() |
OLD | NEW |