OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Unit tests for gclient.py. | 6 """Unit tests for gclient.py. |
7 | 7 |
8 See gclient_smoketest.py for integration tests. | 8 See gclient_smoketest.py for integration tests. |
9 """ | 9 """ |
10 | 10 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 []) | 237 []) |
238 obj.dependencies[0].add_dependencies_and_close( | 238 obj.dependencies[0].add_dependencies_and_close( |
239 [ | 239 [ |
240 gclient.Dependency( | 240 gclient.Dependency( |
241 obj.dependencies[0], 'foo/dir1', 'url', None, None, None, None, | 241 obj.dependencies[0], 'foo/dir1', 'url', None, None, None, None, |
242 None, 'DEPS', True, False), | 242 None, 'DEPS', True, False), |
243 gclient.Dependency( | 243 gclient.Dependency( |
244 obj.dependencies[0], 'foo/dir2', | 244 obj.dependencies[0], 'foo/dir2', |
245 gclient.GClientKeywords.FromImpl('bar'), None, None, None, None, | 245 gclient.GClientKeywords.FromImpl('bar'), None, None, None, None, |
246 None, 'DEPS', True, False), | 246 None, 'DEPS', True, False), |
247 gclient.Dependency( | |
248 obj.dependencies[0], 'foo/dir3', | |
249 gclient.GClientKeywords.FileImpl('url'), None, None, None, None, | |
250 None, 'DEPS', True, False), | |
251 ], | 247 ], |
252 []) | 248 []) |
253 # Make sure __str__() works fine. | 249 # Make sure __str__() works fine. |
254 # pylint: disable=W0212 | 250 # pylint: disable=W0212 |
255 obj.dependencies[0]._file_list.append('foo') | 251 obj.dependencies[0]._file_list.append('foo') |
256 str_obj = str(obj) | 252 str_obj = str(obj) |
257 self.assertEquals(471, len(str_obj), '%d\n%s' % (len(str_obj), str_obj)) | 253 self.assertEquals(370, len(str_obj), '%d\n%s' % (len(str_obj), str_obj)) |
258 | 254 |
259 def testHooks(self): | 255 def testHooks(self): |
260 topdir = self.root_dir | 256 topdir = self.root_dir |
261 gclient_fn = os.path.join(topdir, '.gclient') | 257 gclient_fn = os.path.join(topdir, '.gclient') |
262 fh = open(gclient_fn, 'w') | 258 fh = open(gclient_fn, 'w') |
263 print >> fh, 'solutions = [{"name":"top","url":"svn://example.com/top"}]' | 259 print >> fh, 'solutions = [{"name":"top","url":"svn://example.com/top"}]' |
264 fh.close() | 260 fh.close() |
265 subdir_fn = os.path.join(topdir, 'top') | 261 subdir_fn = os.path.join(topdir, 'top') |
266 os.mkdir(subdir_fn) | 262 os.mkdir(subdir_fn) |
267 deps_fn = os.path.join(subdir_fn, 'DEPS') | 263 deps_fn = os.path.join(subdir_fn, 'DEPS') |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) | 1101 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) |
1106 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) | 1102 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) |
1107 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) | 1103 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) |
1108 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) | 1104 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) |
1109 logging.basicConfig( | 1105 logging.basicConfig( |
1110 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ | 1106 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ |
1111 min(sys.argv.count('-v'), 3)], | 1107 min(sys.argv.count('-v'), 3)], |
1112 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' | 1108 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' |
1113 '%(lineno)d) %(message)s') | 1109 '%(lineno)d) %(message)s') |
1114 unittest.main() | 1110 unittest.main() |
OLD | NEW |