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

Unified Diff: tests/gclient_test.py

Issue 7891061: Fix member lookup to be more stable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
« gclient.py ('K') | « gclient.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/gclient_test.py
diff --git a/tests/gclient_test.py b/tests/gclient_test.py
index 0a5da250ff536ad6964bf0c99d70e9ae5bb922ea..27981b6fbd93895baf3289765eff578d37a5268e 100755
--- a/tests/gclient_test.py
+++ b/tests/gclient_test.py
@@ -203,6 +203,59 @@ class GclientTest(trial_dir.TestCase):
None, '', True)
self.assertEquals('proto://host/path@revision', d.url)
+ def testStr(self):
+ parser = gclient.Parser()
+ options, args = parser.parse_args([])
+ write(
+ '.gclient',
+ 'solutions = [\n'
+ ' { "name": "foo", "url": "svn://example.com/foo" },\n'
+ ' { "name": "bar", "url": "svn://example.com/bar" },\n'
+ ' { "name": "bar/empty", "url": "svn://example.com/bar_empty" },\n'
+ ']')
+ write(
+ os.path.join('foo', 'DEPS'),
+ 'deps = {\n'
+ ' "foo/dir1": "/dir1",\n'
+ # This one will depend on dir1/dir2 in bar.
+ ' "foo/dir1/dir2/dir3": "/dir1/dir2/dir3",\n'
+ ' "foo/dir1/dir2/dir3/dir4": "/dir1/dir2/dir3/dir4",\n'
+ ' "foo/dir1/dir2/dir5/dir6":\n'
+ ' From("foo/dir1/dir2/dir3/dir4", "foo/dir1/dir2"),\n'
+ '}')
+ write(
+ os.path.join('bar', 'DEPS'),
+ 'deps = {\n'
+ ' "foo/dir1/dir2": "/dir1/dir2",\n'
+ '}')
+ write(
+ os.path.join('bar/empty', 'DEPS'),
+ 'deps = {\n'
+ '}')
+ # Test From()
+ write(
+ os.path.join('foo/dir1/dir2/dir3/dir4', 'DEPS'),
+ 'deps = {\n'
+ # This one should not be fetched or set as a requirement.
+ ' "foo/dir1/dir2/dir5": "svn://example.com/x",\n'
+ ' "foo/dir1/dir2": "/dir1/another",\n'
+ '}')
+
+ obj = gclient.GClient.LoadCurrentConfig(options)
+ obj.RunOnDeps('None', args)
+ self.assertEquals(
+ [ 'svn://example.com/foo', 'svn://example.com/bar',
+ 'svn://example.com/bar_empty', 'svn://example.com/foo/dir1',
+ 'svn://example.com/bar/dir1/dir2',
+ 'svn://example.com/foo/dir1/dir2/dir3',
+ 'svn://example.com/foo/dir1/dir2/dir3/dir4',
+ 'svn://example.com/foo/dir1/dir2/dir3/dir4/dir1/another'],
+ self._get_processed())
+ # Inject file_list manually.
+ obj.dependencies[0]._file_list.append('foo') # pylint: disable=W0212
+ self.assertEquals(1874, len(str(obj)), '%d\n%s' % (len(str(obj)), str(obj)))
M-A Ruel 2011/09/14 22:56:55 The whole code above is to test this line.
+
+
if __name__ == '__main__':
logging.basicConfig(
level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][
« gclient.py ('K') | « gclient.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698