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 # pylint: disable=W0212,W0223,W0231,W0613 | 6 # pylint: disable=W0212,W0223,W0231,W0613 |
7 | 7 |
8 import base64 | 8 import base64 |
9 import hashlib | 9 import hashlib |
10 import json | 10 import json |
11 import logging | 11 import logging |
12 import os | 12 import os |
13 import StringIO | 13 import StringIO |
14 import sys | 14 import sys |
15 import tempfile | 15 import tempfile |
16 import unittest | 16 import unittest |
17 import urllib | 17 import urllib |
18 import zlib | 18 import zlib |
19 | 19 |
20 # net_utils adjusts sys.path. | 20 # net_utils adjusts sys.path. |
21 import net_utils | 21 import net_utils |
22 | 22 |
23 import auth | 23 import auth |
24 import isolated_format | 24 import isolated_format |
25 import isolateserver | 25 import isolateserver |
26 import test_utils | 26 import test_utils |
27 from depot_tools import auto_stub | 27 from depot_tools import auto_stub |
| 28 from depot_tools import fix_encoding |
28 from utils import file_path | 29 from utils import file_path |
29 from utils import threading_utils | 30 from utils import threading_utils |
30 | 31 |
31 import isolateserver_mock | 32 import isolateserver_mock |
32 | 33 |
33 | 34 |
34 CONTENTS = { | 35 CONTENTS = { |
35 'empty_file.txt': '', | 36 'empty_file.txt': '', |
36 'small_file.txt': 'small file\n', | 37 'small_file.txt': 'small file\n', |
37 # TODO(maruel): symlinks. | 38 # TODO(maruel): symlinks. |
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 with test_utils.EnvVars({'ISOLATE_SERVER': 'https://localhost:1'}): | 986 with test_utils.EnvVars({'ISOLATE_SERVER': 'https://localhost:1'}): |
986 self.help_test_archive(['archive']) | 987 self.help_test_archive(['archive']) |
987 | 988 |
988 | 989 |
989 def clear_env_vars(): | 990 def clear_env_vars(): |
990 for e in ('ISOLATE_DEBUG', 'ISOLATE_SERVER'): | 991 for e in ('ISOLATE_DEBUG', 'ISOLATE_SERVER'): |
991 os.environ.pop(e, None) | 992 os.environ.pop(e, None) |
992 | 993 |
993 | 994 |
994 if __name__ == '__main__': | 995 if __name__ == '__main__': |
| 996 fix_encoding.fix_encoding() |
995 if '-v' in sys.argv: | 997 if '-v' in sys.argv: |
996 unittest.TestCase.maxDiff = None | 998 unittest.TestCase.maxDiff = None |
997 logging.basicConfig( | 999 logging.basicConfig( |
998 level=(logging.DEBUG if '-v' in sys.argv else logging.CRITICAL)) | 1000 level=(logging.DEBUG if '-v' in sys.argv else logging.CRITICAL)) |
999 clear_env_vars() | 1001 clear_env_vars() |
1000 unittest.main() | 1002 unittest.main() |
OLD | NEW |