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

Side by Side Diff: client/tests/net_utils.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_test.py ('k') | client/tests/on_error_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 # Copyright 2014 The LUCI Authors. All rights reserved. 1 # Copyright 2014 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 import logging 5 import logging
6 import os 6 import os
7 import sys 7 import sys
8 import threading 8 import threading
9 9
10 TEST_DIR = os.path.dirname(os.path.abspath(__file__)) 10 TEST_DIR = os.path.dirname(os.path.abspath(
11 __file__.decode(sys.getfilesystemencoding())))
11 ROOT_DIR = os.path.dirname(TEST_DIR) 12 ROOT_DIR = os.path.dirname(TEST_DIR)
12 sys.path.insert(0, ROOT_DIR) 13 sys.path.insert(0, ROOT_DIR)
13 sys.path.insert(0, os.path.join(ROOT_DIR, 'third_party')) 14 sys.path.insert(0, os.path.join(ROOT_DIR, 'third_party'))
14 15
15 from depot_tools import auto_stub 16 from depot_tools import auto_stub
16 from utils import net 17 from utils import net
17 18
18 19
19 def make_fake_response(content, url, headers=None): 20 def make_fake_response(content, url, headers=None):
20 """Returns HttpResponse with predefined content, useful in tests.""" 21 """Returns HttpResponse with predefined content, useful in tests."""
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 self.fail('Expected json request, got normal data; %s' % url) 107 self.fail('Expected json request, got normal data; %s' % url)
107 _, expected_kwargs, result = data 108 _, expected_kwargs, result = data
108 if callable(expected_kwargs): 109 if callable(expected_kwargs):
109 expected_kwargs(kwargs) 110 expected_kwargs(kwargs)
110 else: 111 else:
111 self.assertEqual(expected_kwargs, kwargs) 112 self.assertEqual(expected_kwargs, kwargs)
112 if result is not None: 113 if result is not None:
113 return result 114 return result
114 return None 115 return None
115 self.fail('Unknown request %s %s' % (url, kwargs)) 116 self.fail('Unknown request %s %s' % (url, kwargs))
OLDNEW
« no previous file with comments | « client/tests/net_test.py ('k') | client/tests/on_error_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698