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

Side by Side Diff: client/tests/file_path_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/swarming.py ('k') | client/tests/isolate_format_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 # coding=utf-8 2 # coding=utf-8
3 # Copyright 2013 The LUCI Authors. All rights reserved. 3 # Copyright 2013 The LUCI Authors. All rights reserved.
4 # Use of this source code is governed under the Apache License, Version 2.0 4 # Use of this source code is governed under the Apache License, Version 2.0
5 # that can be found in the LICENSE file. 5 # that can be found in the LICENSE file.
6 6
7 import getpass 7 import getpass
8 import logging 8 import logging
9 import os 9 import os
10 import tempfile 10 import tempfile
11 import unittest 11 import unittest
12 import StringIO 12 import StringIO
13 import subprocess 13 import subprocess
14 import sys 14 import sys
15 import time 15 import time
16 16
17 BASE_DIR = unicode(os.path.dirname(os.path.abspath(__file__))) 17 BASE_DIR = os.path.dirname(os.path.abspath(
18 __file__.decode(sys.getfilesystemencoding())))
18 ROOT_DIR = os.path.dirname(BASE_DIR) 19 ROOT_DIR = os.path.dirname(BASE_DIR)
19 sys.path.insert(0, ROOT_DIR) 20 sys.path.insert(0, ROOT_DIR)
20 sys.path.insert(0, os.path.join(ROOT_DIR, 'third_party')) 21 sys.path.insert(0, os.path.join(ROOT_DIR, 'third_party'))
21 22
22 FILE_PATH = unicode(os.path.abspath(__file__)) 23 FILE_PATH = os.path.abspath(__file__.decode(sys.getfilesystemencoding()))
23 24
24 from depot_tools import auto_stub 25 from depot_tools import auto_stub
25 from depot_tools import fix_encoding 26 from depot_tools import fix_encoding
26 import test_utils 27 import test_utils
27 from utils import file_path 28 from utils import file_path
28 from utils import fs 29 from utils import fs
29 30
30 31
31 def write_content(filepath, content): 32 def write_content(filepath, content):
32 with fs.open(filepath, 'wb') as f: 33 with fs.open(filepath, 'wb') as f:
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 file_path.rmtree(dirpath) 411 file_path.rmtree(dirpath)
411 412
412 413
413 if __name__ == '__main__': 414 if __name__ == '__main__':
414 fix_encoding.fix_encoding() 415 fix_encoding.fix_encoding()
415 logging.basicConfig( 416 logging.basicConfig(
416 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR) 417 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR)
417 if '-v' in sys.argv: 418 if '-v' in sys.argv:
418 unittest.TestCase.maxDiff = None 419 unittest.TestCase.maxDiff = None
419 unittest.main() 420 unittest.main()
OLDNEW
« no previous file with comments | « client/swarming.py ('k') | client/tests/isolate_format_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698