OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Swarming Authors. All rights reserved. | 2 # Copyright 2013 The Swarming Authors. All rights reserved. |
3 # Use of this source code is governed under the Apache License, Version 2.0 that | 3 # Use of this source code is governed under the Apache License, Version 2.0 that |
4 # can be found in the LICENSE file. | 4 # can be found in the LICENSE file. |
5 | 5 |
6 import datetime | 6 import datetime |
7 import hashlib | 7 import hashlib |
8 import json | 8 import json |
9 import logging | 9 import logging |
10 import os | 10 import os |
11 import StringIO | 11 import StringIO |
12 import subprocess | 12 import subprocess |
13 import sys | 13 import sys |
14 import tempfile | 14 import tempfile |
15 import threading | 15 import threading |
16 import time | 16 import time |
17 import unittest | 17 import unittest |
18 | 18 |
19 # net_utils adjusts sys.path. | 19 # net_utils adjusts sys.path. |
20 import net_utils | 20 import net_utils |
21 | 21 |
22 from depot_tools import auto_stub | 22 from depot_tools import auto_stub |
23 | 23 |
24 import auth | 24 import auth |
25 import isolateserver | 25 import isolateserver |
26 import swarming | 26 import swarming |
27 import test_utils | 27 import test_utils |
28 | 28 |
| 29 from depot_tools import fix_encoding |
29 from utils import file_path | 30 from utils import file_path |
30 from utils import logging_utils | 31 from utils import logging_utils |
31 from utils import tools | 32 from utils import tools |
32 | 33 |
33 import isolateserver_mock | 34 import isolateserver_mock |
34 | 35 |
35 | 36 |
36 FILE_HASH = u'1' * 40 | 37 FILE_HASH = u'1' * 40 |
37 TEST_NAME = u'unit_tests' | 38 TEST_NAME = u'unit_tests' |
38 | 39 |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 '--dimension', 'os', 'Linux', '--dead-only', | 1206 '--dimension', 'os', 'Linux', '--dead-only', |
1206 ]) | 1207 ]) |
1207 expected = ( | 1208 expected = ( |
1208 u'swarm1\n {"cores": ["8"], "cpu": ["x86", "x86-64"], "gpu": [], ' | 1209 u'swarm1\n {"cores": ["8"], "cpu": ["x86", "x86-64"], "gpu": [], ' |
1209 '"id": ["swarm1"], "os": ["Linux", "Linux-12.04"]}\n') | 1210 '"id": ["swarm1"], "os": ["Linux", "Linux-12.04"]}\n') |
1210 self._check_output(expected, '') | 1211 self._check_output(expected, '') |
1211 self.assertEqual(0, ret) | 1212 self.assertEqual(0, ret) |
1212 | 1213 |
1213 | 1214 |
1214 if __name__ == '__main__': | 1215 if __name__ == '__main__': |
| 1216 fix_encoding.fix_encoding() |
1215 logging.basicConfig( | 1217 logging.basicConfig( |
1216 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL) | 1218 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL) |
1217 if '-v' in sys.argv: | 1219 if '-v' in sys.argv: |
1218 unittest.TestCase.maxDiff = None | 1220 unittest.TestCase.maxDiff = None |
1219 for e in ('ISOLATE_SERVER', 'SWARMING_TASK_ID', 'SWARMING_SERVER'): | 1221 for e in ('ISOLATE_SERVER', 'SWARMING_TASK_ID', 'SWARMING_SERVER'): |
1220 os.environ.pop(e, None) | 1222 os.environ.pop(e, None) |
1221 unittest.main() | 1223 unittest.main() |
OLD | NEW |