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), |
247 ], | 251 ], |
248 []) | 252 []) |
249 # Make sure __str__() works fine. | 253 # Make sure __str__() works fine. |
250 # pylint: disable=W0212 | 254 # pylint: disable=W0212 |
251 obj.dependencies[0]._file_list.append('foo') | 255 obj.dependencies[0]._file_list.append('foo') |
252 str_obj = str(obj) | 256 str_obj = str(obj) |
253 self.assertEquals(370, len(str_obj), '%d\n%s' % (len(str_obj), str_obj)) | 257 self.assertEquals(471, len(str_obj), '%d\n%s' % (len(str_obj), str_obj)) |
254 | 258 |
255 def testHooks(self): | 259 def testHooks(self): |
256 topdir = self.root_dir | 260 topdir = self.root_dir |
257 gclient_fn = os.path.join(topdir, '.gclient') | 261 gclient_fn = os.path.join(topdir, '.gclient') |
258 fh = open(gclient_fn, 'w') | 262 fh = open(gclient_fn, 'w') |
259 print >> fh, 'solutions = [{"name":"top","url":"svn://example.com/top"}]' | 263 print >> fh, 'solutions = [{"name":"top","url":"svn://example.com/top"}]' |
260 fh.close() | 264 fh.close() |
261 subdir_fn = os.path.join(topdir, 'top') | 265 subdir_fn = os.path.join(topdir, 'top') |
262 os.mkdir(subdir_fn) | 266 os.mkdir(subdir_fn) |
263 deps_fn = os.path.join(subdir_fn, 'DEPS') | 267 deps_fn = os.path.join(subdir_fn, 'DEPS') |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) | 1105 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) |
1102 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) | 1106 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) |
1103 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) | 1107 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) |
1104 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) | 1108 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) |
1105 logging.basicConfig( | 1109 logging.basicConfig( |
1106 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ | 1110 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ |
1107 min(sys.argv.count('-v'), 3)], | 1111 min(sys.argv.count('-v'), 3)], |
1108 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' | 1112 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' |
1109 '%(lineno)d) %(message)s') | 1113 '%(lineno)d) %(message)s') |
1110 unittest.main() | 1114 unittest.main() |
OLD | NEW |