| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # coding=utf-8 | 2 # coding=utf-8 |
| 3 # Copyright 2013 The Swarming Authors. All rights reserved. | 3 # Copyright 2013 The Swarming Authors. All rights reserved. |
| 4 # Use of this source code is governed by the Apache v2.0 license that can be | 4 # Use of this source code is governed by the Apache v2.0 license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 import StringIO | 7 import StringIO |
| 8 import base64 | 8 import base64 |
| 9 import json | 9 import json |
| 10 import logging | 10 import logging |
| 11 import os | 11 import os |
| 12 import signal | 12 import signal |
| 13 import shutil | 13 import shutil |
| 14 import subprocess | 14 import subprocess |
| 15 import sys | 15 import sys |
| 16 import tempfile | 16 import tempfile |
| 17 import time | 17 import time |
| 18 import unittest | 18 import unittest |
| 19 import zipfile | 19 import zipfile |
| 20 | 20 |
| 21 import test_env | 21 import test_env |
| 22 test_env.setup_test_env() | 22 test_env.setup_test_env() |
| 23 | 23 |
| 24 # Creates a server mock for functions in net.py. | 24 # Creates a server mock for functions in net.py. |
| 25 import net_utils | 25 import net_utils |
| 26 | 26 |
| 27 import logging_utils | |
| 28 from utils import file_path | 27 from utils import file_path |
| 28 from utils import logging_utils |
| 29 from utils import subprocess42 | 29 from utils import subprocess42 |
| 30 import task_runner | 30 import task_runner |
| 31 import xsrf_client | 31 import xsrf_client |
| 32 | 32 |
| 33 | 33 |
| 34 def compress_to_zip(files): | 34 def compress_to_zip(files): |
| 35 out = StringIO.StringIO() | 35 out = StringIO.StringIO() |
| 36 with zipfile.ZipFile(out, 'w') as zip_file: | 36 with zipfile.ZipFile(out, 'w') as zip_file: |
| 37 for item, content in files.iteritems(): | 37 for item, content in files.iteritems(): |
| 38 zip_file.writestr(item, content) | 38 zip_file.writestr(item, content) |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 pass | 732 pass |
| 733 | 733 |
| 734 | 734 |
| 735 if __name__ == '__main__': | 735 if __name__ == '__main__': |
| 736 if '-v' in sys.argv: | 736 if '-v' in sys.argv: |
| 737 unittest.TestCase.maxDiff = None | 737 unittest.TestCase.maxDiff = None |
| 738 logging_utils.prepare_logging(None) | 738 logging_utils.prepare_logging(None) |
| 739 logging_utils.set_console_level( | 739 logging_utils.set_console_level( |
| 740 logging.DEBUG if '-v' in sys.argv else logging.CRITICAL+1) | 740 logging.DEBUG if '-v' in sys.argv else logging.CRITICAL+1) |
| 741 unittest.main() | 741 unittest.main() |
| OLD | NEW |