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

Unified Diff: tests/gclient_test.py

Issue 9232068: Added `gclient hookinfo`. This will be used to convert hooks into (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 8 years, 9 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
« no previous file with comments | « 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
===================================================================
--- tests/gclient_test.py (revision 126269)
+++ tests/gclient_test.py (working copy)
@@ -246,7 +246,37 @@
str_obj = str(obj)
self.assertEquals(471, len(str_obj), '%d\n%s' % (len(str_obj), str_obj))
+ def testHooks(self):
+ topdir = self.root_dir
+ gclient_fn = os.path.join(topdir, '.gclient')
+ fh = open(gclient_fn, 'w')
+ print >> fh, 'solutions = [{"name":"top","url":"svn://svn.top.com/top"}]'
+ fh.close()
+ subdir_fn = os.path.join(topdir, 'top')
+ os.mkdir(subdir_fn)
+ deps_fn = os.path.join(subdir_fn, 'DEPS')
+ fh = open(deps_fn, 'w')
+ hooks = [{'pattern':'.', 'action':['cmd1', 'arg1', 'arg2']}]
+ print >> fh, 'hooks = %s' % repr(hooks)
+ fh.close()
+ fh = open(os.path.join(subdir_fn, 'fake.txt'), 'w')
+ print >> fh, 'bogus content'
+ fh.close()
+
+ os.chdir(topdir)
+
+ parser = gclient.Parser()
+ options, _ = parser.parse_args([])
+ options.force = True
+ client = gclient.GClient.LoadCurrentConfig(options)
+ work_queue = gclient_utils.ExecutionQueue(options.jobs, None)
+ for s in client.dependencies:
+ work_queue.enqueue(s)
+ work_queue.flush({}, None, [], options=options)
+ self.assertEqual(client.GetHooks(options), [x['action'] for x in hooks])
+
+
if __name__ == '__main__':
sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout)
sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True)
« no previous file with comments | « gclient.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698