Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: appengine/swarming/swarming_bot/bot_code/task_runner_test.py

Issue 1390773002: Add an assert to ensure UTF-8 locale when handling file paths. (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: More fixes Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 sys 14 import sys
15 import tempfile 15 import tempfile
16 import time 16 import time
17 import unittest 17 import unittest
18 import zipfile 18 import zipfile
19 19
20 import test_env_bot_code 20 import test_env_bot_code
21 test_env_bot_code.setup_test_env() 21 test_env_bot_code.setup_test_env()
22 22
23 # Creates a server mock for functions in net.py. 23 # Creates a server mock for functions in net.py.
24 import net_utils 24 import net_utils
25 25
26 from depot_tools import fix_encoding
26 from utils import file_path 27 from utils import file_path
27 from utils import logging_utils 28 from utils import logging_utils
28 from utils import subprocess42 29 from utils import subprocess42
29 from utils import tools 30 from utils import tools
30 import fake_swarming 31 import fake_swarming
31 import task_runner 32 import task_runner
32 import xsrf_client 33 import xsrf_client
33 34
34 35
35 def compress_to_zip(files): 36 def compress_to_zip(files):
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 u'must_signal_internal_failure': 1009 u'must_signal_internal_failure':
1009 u'task_runner received signal %d' % task_runner.SIG_BREAK_OR_TERM, 1010 u'task_runner received signal %d' % task_runner.SIG_BREAK_OR_TERM,
1010 u'version': 3, 1011 u'version': 3,
1011 } 1012 }
1012 with open(task_result_file, 'rb') as f: 1013 with open(task_result_file, 'rb') as f:
1013 self.assertEqual(expected, json.load(f)) 1014 self.assertEqual(expected, json.load(f))
1014 self.assertEqual(0, proc.returncode) 1015 self.assertEqual(0, proc.returncode)
1015 1016
1016 1017
1017 if __name__ == '__main__': 1018 if __name__ == '__main__':
1019 fix_encoding.fix_encoding()
1018 if '-v' in sys.argv: 1020 if '-v' in sys.argv:
1019 unittest.TestCase.maxDiff = None 1021 unittest.TestCase.maxDiff = None
1020 logging_utils.prepare_logging(None) 1022 logging_utils.prepare_logging(None)
1021 logging_utils.set_console_level( 1023 logging_utils.set_console_level(
1022 logging.DEBUG if '-v' in sys.argv else logging.CRITICAL+1) 1024 logging.DEBUG if '-v' in sys.argv else logging.CRITICAL+1)
1023 # Fix litteral text expectation. 1025 # Fix litteral text expectation.
1024 os.environ['LANG'] = 'en_US.UTF-8' 1026 os.environ['LANG'] = 'en_US.UTF-8'
1025 os.environ['LANGUAGE'] = 'en_US.UTF-8' 1027 os.environ['LANGUAGE'] = 'en_US.UTF-8'
1026 unittest.main() 1028 unittest.main()
OLDNEW
« no previous file with comments | « appengine/swarming/swarming_bot/bot_code/bot_main_test.py ('k') | appengine/swarming/swarming_bot/main_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698