Chromium Code Reviews| Index: tests/gclient_test.py |
| =================================================================== |
| --- tests/gclient_test.py (revision 132861) |
| +++ tests/gclient_test.py (working copy) |
| @@ -210,7 +210,7 @@ |
| # auto-fixed. |
| d = gclient.Dependency( |
| None, 'name', 'proto://host/path/@revision', None, None, None, |
| - None, '', True) |
| + None, '', None, True) |
| self.assertEquals('proto://host/path@revision', d.url) |
| def testStr(self): |
| @@ -220,24 +220,24 @@ |
| obj.add_dependencies_and_close( |
| [ |
| gclient.Dependency( |
| - obj, 'foo', 'url', None, None, None, None, 'DEPS', True), |
| + obj, 'foo', 'url', None, None, None, None, 'DEPS', None, True), |
| gclient.Dependency( |
| - obj, 'bar', 'url', None, None, None, None, 'DEPS', True), |
| + obj, 'bar', 'url', None, None, None, None, 'DEPS', None, True), |
| ], |
| []) |
| obj.dependencies[0].add_dependencies_and_close( |
| [ |
| gclient.Dependency( |
| obj.dependencies[0], 'foo/dir1', 'url', None, None, None, None, |
| - 'DEPS', True), |
| + 'DEPS', None, True), |
| gclient.Dependency( |
| obj.dependencies[0], 'foo/dir2', |
| gclient.GClientKeywords.FromImpl('bar'), None, None, None, None, |
| - 'DEPS', True), |
| + 'DEPS', None, True), |
| gclient.Dependency( |
| obj.dependencies[0], 'foo/dir3', |
| gclient.GClientKeywords.FileImpl('url'), None, None, None, None, |
| - 'DEPS', True), |
| + 'DEPS', None, True), |
| ], |
| []) |
| # Make sure __str__() works fine. |
| @@ -276,7 +276,42 @@ |
| work_queue.flush({}, None, [], options=options) |
| self.assertEqual(client.GetHooks(options), [x['action'] for x in hooks]) |
| + def testTargetOS(self): |
| + """Verifies that specifying a target_os pulls in all relevant dependencies. |
| + The target_os variable allows specifying the name of an additional OS which |
| + should be considered when selecting dependencies from a DEPS' deps_os. The |
| + value will be appended to the enforced_os tuple. |
| + """ |
| + |
| + write( |
| + '.gclient', |
| + 'solutions = [\n' |
|
John Grabowski
2012/04/19 05:29:04
"""
for multi-line strings in python,
prefer tripl
Peter Beverloo
2012/04/19 06:11:03
Only following the file's convention :-). I have u
|
| + ' { "name": "foo",\n' |
| + ' "url": "svn://example.com/foo",\n' |
| + ' "target_os": "baz",\n' |
| + ' }\n' |
| + ']') |
| + write( |
| + os.path.join('foo', 'DEPS'), |
| + 'deps = {\n' |
| + ' "foo/dir1": "/dir1",' |
| + '}\n' |
| + 'deps_os = {\n' |
| + ' "unix": { "foo/dir2": "/dir2", },\n' |
| + ' "baz": { "foo/dir3": "/dir3", },\n' |
| + '}') |
| + |
| + parser = gclient.Parser() |
| + options, args = parser.parse_args(['--jobs', '1']) |
| + options.deps_os = "unix" |
| + |
| + obj = gclient.GClient.LoadCurrentConfig(options) |
| + obj.RunOnDeps('None', args) |
| + |
| + self.assertEqual(4, len(self._get_processed())) |
|
John Grabowski
2012/04/19 05:29:04
I don't understand this. 1 dep, plus 1 for unix,
Peter Beverloo
2012/04/19 06:11:03
svn://example.com/foo is also being processed (top
|
| + |
| + |
| if __name__ == '__main__': |
| sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) |
| sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) |