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

Side by Side Diff: tests/gclient_test.py

Issue 2395013002: Remove safesync support from gclient[_scm].py (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 | « tests/gclient_smoketest.py ('k') | no next file » | 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 (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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 while True: 212 while True:
213 items.append(self.processed.get_nowait()) 213 items.append(self.processed.get_nowait())
214 except Queue.Empty: 214 except Queue.Empty:
215 pass 215 pass
216 return items 216 return items
217 217
218 def testAutofix(self): 218 def testAutofix(self):
219 # Invalid urls causes pain when specifying requirements. Make sure it's 219 # Invalid urls causes pain when specifying requirements. Make sure it's
220 # auto-fixed. 220 # auto-fixed.
221 d = gclient.Dependency( 221 d = gclient.Dependency(
222 None, 'name', 'proto://host/path/@revision', None, None, None, None, 222 None, 'name', 'proto://host/path/@revision', None, None, None,
223 None, '', True, False) 223 None, '', True, False)
224 self.assertEquals('proto://host/path@revision', d.url) 224 self.assertEquals('proto://host/path@revision', d.url)
225 225
226 def testStr(self): 226 def testStr(self):
227 parser = gclient.OptionParser() 227 parser = gclient.OptionParser()
228 options, _ = parser.parse_args([]) 228 options, _ = parser.parse_args([])
229 obj = gclient.GClient('foo', options) 229 obj = gclient.GClient('foo', options)
230 obj.add_dependencies_and_close( 230 obj.add_dependencies_and_close(
231 [ 231 [
232 gclient.Dependency( 232 gclient.Dependency(
233 obj, 'foo', 'url', None, None, None, None, None, 'DEPS', True, False), 233 obj, 'foo', 'url', None, None, None, None, 'DEPS', True, False),
234 gclient.Dependency( 234 gclient.Dependency(
235 obj, 'bar', 'url', None, None, None, None, None, 'DEPS', True, False), 235 obj, 'bar', 'url', None, None, None, None, 'DEPS', True, False),
236 ], 236 ],
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,
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,
246 None, 'DEPS', True, False), 246 None, 'DEPS', True, False),
247 ], 247 ],
248 []) 248 [])
249 # Make sure __str__() works fine. 249 # Make sure __str__() works fine.
250 # pylint: disable=W0212 250 # pylint: disable=W0212
251 obj.dependencies[0]._file_list.append('foo') 251 obj.dependencies[0]._file_list.append('foo')
252 str_obj = str(obj) 252 str_obj = str(obj)
253 self.assertEquals(370, 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))
254 254
255 def testHooks(self): 255 def testHooks(self):
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 orig_deps = copy.deepcopy(deps) 556 orig_deps = copy.deepcopy(deps)
557 result = gclient.Dependency.MergeWithOsDeps(deps, deps_os, target_os_list) 557 result = gclient.Dependency.MergeWithOsDeps(deps, deps_os, target_os_list)
558 self.assertEqual(result, expected_deps) 558 self.assertEqual(result, expected_deps)
559 self.assertEqual(deps, orig_deps) 559 self.assertEqual(deps, orig_deps)
560 560
561 561
562 def testLateOverride(self): 562 def testLateOverride(self):
563 """Verifies expected behavior of LateOverride.""" 563 """Verifies expected behavior of LateOverride."""
564 url = "git@github.com:dart-lang/spark.git" 564 url = "git@github.com:dart-lang/spark.git"
565 d = gclient.Dependency(None, 'name', 'url', 565 d = gclient.Dependency(None, 'name', 'url',
566 None, None, None, None, None, '', True, False) 566 None, None, None, None, '', True, False)
567 late_url = d.LateOverride(url) 567 late_url = d.LateOverride(url)
568 self.assertEquals(url, late_url) 568 self.assertEquals(url, late_url)
569 569
570 def testDepsOsOverrideDepsInDepsFile(self): 570 def testDepsOsOverrideDepsInDepsFile(self):
571 """Verifies that a 'deps_os' path can override a 'deps' path. Also 571 """Verifies that a 'deps_os' path can override a 'deps' path. Also
572 see testUpdateWithOsDeps above. 572 see testUpdateWithOsDeps above.
573 """ 573 """
574 574
575 write( 575 write(
576 '.gclient', 576 '.gclient',
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) 1101 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout)
1102 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) 1102 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True)
1103 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) 1103 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr)
1104 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) 1104 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True)
1105 logging.basicConfig( 1105 logging.basicConfig(
1106 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ 1106 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][
1107 min(sys.argv.count('-v'), 3)], 1107 min(sys.argv.count('-v'), 3)],
1108 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' 1108 format='%(relativeCreated)4d %(levelname)5s %(module)13s('
1109 '%(lineno)d) %(message)s') 1109 '%(lineno)d) %(message)s')
1110 unittest.main() 1110 unittest.main()
OLDNEW
« no previous file with comments | « tests/gclient_smoketest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698