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

Side by Side Diff: client/tests/on_error_test.py

Issue 2093593002: luci-py: Making __file__ usage unicode safe. (Closed) Base URL: https://github.com/luci/luci-py.git@master
Patch Set: Small fixes. Created 4 years, 6 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
« no previous file with comments | « client/tests/net_utils.py ('k') | client/tests/run_isolated_smoke_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The LUCI Authors. All rights reserved. 2 # Copyright 2014 The LUCI Authors. All rights reserved.
3 # Use of this source code is governed under the Apache License, Version 2.0 3 # Use of this source code is governed under the Apache License, Version 2.0
4 # that can be found in the LICENSE file. 4 # that can be found in the LICENSE file.
5 5
6 import BaseHTTPServer 6 import BaseHTTPServer
7 import atexit 7 import atexit
8 import cgi 8 import cgi
9 import getpass 9 import getpass
10 import json 10 import json
11 import logging 11 import logging
12 import os 12 import os
13 import platform 13 import platform
14 import re 14 import re
15 import socket 15 import socket
16 import ssl 16 import ssl
17 import subprocess 17 import subprocess
18 import sys 18 import sys
19 import threading 19 import threading
20 import unittest 20 import unittest
21 import urllib 21 import urllib
22 import urlparse 22 import urlparse
23 23
24 TESTS_DIR = os.path.dirname(os.path.abspath(__file__)) 24 TESTS_DIR = os.path.dirname(os.path.abspath(
25 __file__.decode(sys.getfilesystemencoding())))
25 ROOT_DIR = os.path.dirname(TESTS_DIR) 26 ROOT_DIR = os.path.dirname(TESTS_DIR)
26 sys.path.insert(0, ROOT_DIR) 27 sys.path.insert(0, ROOT_DIR)
27 sys.path.insert(0, os.path.join(ROOT_DIR, 'third_party')) 28 sys.path.insert(0, os.path.join(ROOT_DIR, 'third_party'))
28 29
29 from depot_tools import auto_stub 30 from depot_tools import auto_stub
31 from depot_tools import fix_encoding
32
30 from utils import on_error 33 from utils import on_error
31 34
32 35
33 PEM = os.path.join(TESTS_DIR, 'self_signed.pem') 36 PEM = os.path.join(TESTS_DIR, 'self_signed.pem')
34 37
35 38
36 # Access to a protected member XXX of a client class - pylint: disable=W0212 39 # Access to a protected member XXX of a client class - pylint: disable=W0212
37 40
38 41
39 def _serialize_env(): 42 def _serialize_env():
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 if mode == 'exception_no_msg': 403 if mode == 'exception_no_msg':
401 # Report from inside an exception frame. 404 # Report from inside an exception frame.
402 try: 405 try:
403 raise TypeError('You are not my type #2') 406 raise TypeError('You are not my type #2')
404 except TypeError: 407 except TypeError:
405 on_error.report(None) 408 on_error.report(None)
406 return 0 409 return 0
407 410
408 411
409 if __name__ == '__main__': 412 if __name__ == '__main__':
413 fix_encoding.fix_encoding()
414
410 # Ignore _DISABLE_ENVVAR if set. 415 # Ignore _DISABLE_ENVVAR if set.
411 os.environ.pop(on_error._DISABLE_ENVVAR, None) 416 os.environ.pop(on_error._DISABLE_ENVVAR, None)
412 417
413 if len(sys.argv) == 4 and sys.argv[1] == 'run_shell_out': 418 if len(sys.argv) == 4 and sys.argv[1] == 'run_shell_out':
414 sys.exit(run_shell_out(sys.argv[2], sys.argv[3])) 419 sys.exit(run_shell_out(sys.argv[2], sys.argv[3]))
415 420
416 if '-v' in sys.argv: 421 if '-v' in sys.argv:
417 unittest.TestCase.maxDiff = None 422 unittest.TestCase.maxDiff = None
418 logging.basicConfig( 423 logging.basicConfig(
419 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR) 424 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR)
420 unittest.main() 425 unittest.main()
OLDNEW
« no previous file with comments | « client/tests/net_utils.py ('k') | client/tests/run_isolated_smoke_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698