def testStr(self): parser = gclient.OptionParser() options, _ = parser.parse_args([]) obj = gclient.GClient('foo', options) obj.add_dependencies_and_close( [ gclient.Dependency( obj, 'foo', 'url', None, None, None, None, None, 'DEPS', True), gclient.Dependency( obj, 'bar', 'url', None, None, None, None, None, 'DEPS', True), ], []) obj.dependencies[0].add_dependencies_and_close( [ gclient.Dependency( obj.dependencies[0], 'foo/dir1', 'url', None, None, None, None, None, 'DEPS', True), gclient.Dependency( obj.dependencies[0], 'foo/dir2', gclient.GClientKeywords.FromImpl('bar'), None, None, None, None, None, 'DEPS', True), gclient.Dependency( obj.dependencies[0], 'foo/dir3', gclient.GClientKeywords.FileImpl('url'), None, None, None, None, None, 'DEPS', True), ], []) # Make sure __str__() works fine. # pylint: disable=W0212 obj.dependencies[0]._file_list.append('foo') str_obj = str(obj) self.assertEquals(471, len(str_obj), '%d\n%s' % (len(str_obj), str_obj))
def testSameDirAllowMultipleCipdDeps(self): """Verifies gclient allow multiple cipd deps under same directory.""" parser = gclient.OptionParser() options, _ = parser.parse_args([]) obj = gclient.GClient('foo', options) cipd_root = gclient_scm.CipdRoot(os.path.join(self.root_dir, 'dir1'), 'https://example.com') obj.add_dependencies_and_close([ gclient.Dependency(obj, 'foo', 'raw_url', 'url', None, None, None, None, 'DEPS', True, False, None, True), ], []) obj.dependencies[0].add_dependencies_and_close([ gclient.CipdDependency(obj.dependencies[0], 'foo', { 'package': 'foo_package', 'version': 'foo_version' }, cipd_root, None, True, False, 'fake_condition', True), gclient.CipdDependency(obj.dependencies[0], 'foo', { 'package': 'bar_package', 'version': 'bar_version' }, cipd_root, None, True, False, 'fake_condition', True), ], []) dep0 = obj.dependencies[0].dependencies[0] dep1 = obj.dependencies[0].dependencies[1] self.assertEquals('https://example.com/foo_package@foo_version', dep0.url) self.assertEquals('https://example.com/bar_package@bar_version', dep1.url)
def testStr(self): parser = gclient.OptionParser() options, _ = parser.parse_args([]) obj = gclient.GClient('foo', options) obj.add_dependencies_and_close( [ gclient.Dependency( parent=obj, name='foo', url='svn://example.com/foo', managed=None, custom_deps=None, custom_vars=None, custom_hooks=None, deps_file='DEPS', should_process=True, should_recurse=True, relative=False, condition=None, print_outbuf=True), gclient.Dependency( parent=obj, name='bar', url='svn://example.com/bar', managed=None, custom_deps=None, custom_vars=None, custom_hooks=None, deps_file='DEPS', should_process=True, should_recurse=False, relative=False, condition=None, print_outbuf=True), ], []) obj.dependencies[0].add_dependencies_and_close( [ gclient.Dependency( parent=obj.dependencies[0], name='foo/dir1', url='svn://example.com/foo/dir1', managed=None, custom_deps=None, custom_vars=None, custom_hooks=None, deps_file='DEPS', should_process=True, should_recurse=False, relative=False, condition=None, print_outbuf=True), ], []) # TODO(ehmaldonado): Improve this test. # Make sure __str__() works fine. # pylint: disable=protected-access obj.dependencies[0]._file_list.append('foo') str_obj = str(obj) self.assertEqual(322, len(str_obj), '%d\n%s' % (len(str_obj), str_obj))
def testStr(self): parser = gclient.OptionParser() options, _ = parser.parse_args([]) obj = gclient.GClient('foo', options) obj.add_dependencies_and_close( [ gclient.Dependency( obj, 'foo', 'raw_url', 'url', None, None, None, None, 'DEPS', True, False, None, True), gclient.Dependency( obj, 'bar', 'raw_url', 'url', None, None, None, None, 'DEPS', True, False, None, True), ], []) obj.dependencies[0].add_dependencies_and_close( [ gclient.Dependency( obj.dependencies[0], 'foo/dir1', 'raw_url', 'url', None, None, None, None, 'DEPS', True, False, None, True), ], []) # Make sure __str__() works fine. # pylint: disable=protected-access obj.dependencies[0]._file_list.append('foo') str_obj = str(obj) self.assertEquals(263, len(str_obj), '%d\n%s' % (len(str_obj), str_obj))
def testFromText(self): options = self.Options(spec='config_source_content') gclient.os.path.exists(options.config_filename).AndReturn(False) gclient.GClient('.', options).AndReturn(gclient.GClient) gclient.GClient.SetConfig(options.spec) gclient.GClient.SaveConfig() self.mox.ReplayAll() gclient.DoConfig(options, (1,),)
def testLoadCurrentConfig(self): options = self.Options() gclient.os.path.realpath(self.root_dir).AndReturn(self.root_dir) gclient.os.path.exists( gclient.os.path.join(self.root_dir, options.config_filename) ).AndReturn(True) gclient.GClient(self.root_dir, options).AndReturn(gclient.GClient) gclient.GClient._LoadConfig() self.mox.ReplayAll() client = self._gclient_gclient.LoadCurrentConfig(options, self.root_dir)
def testCreateClientFile(self): options = self.Options() gclient.os.path.exists(options.config_filename).AndReturn(False) gclient.GClient('.', options).AndReturn(gclient.GClient) gclient.GClient.SetDefaultConfig('the_name', 'http://svn/url/the_name', 'other') gclient.GClient.SaveConfig() self.mox.ReplayAll() gclient.DoConfig(options, ('http://svn/url/the_name', 'other', 'args', 'ignored'))
def testSameDirAllowMultipleCipdDeps(self): """Verifies gclient allow multiple cipd deps under same directory.""" parser = gclient.OptionParser() options, _ = parser.parse_args([]) obj = gclient.GClient('foo', options) cipd_root = gclient_scm.CipdRoot( os.path.join(self.root_dir, 'dir1'), 'https://example.com') obj.add_dependencies_and_close( [ gclient.Dependency( parent=obj, name='foo', url='svn://example.com/foo', managed=None, custom_deps=None, custom_vars=None, custom_hooks=None, deps_file='DEPS', should_process=True, should_recurse=True, relative=False, condition=None, print_outbuf=True), ], []) obj.dependencies[0].add_dependencies_and_close( [ gclient.CipdDependency( parent=obj.dependencies[0], name='foo', dep_value={'package': 'foo_package', 'version': 'foo_version'}, cipd_root=cipd_root, custom_vars=None, should_process=True, relative=False, condition='fake_condition'), gclient.CipdDependency( parent=obj.dependencies[0], name='bar', dep_value={'package': 'bar_package', 'version': 'bar_version'}, cipd_root=cipd_root, custom_vars=None, should_process=True, relative=False, condition='fake_condition'), ], []) dep0 = obj.dependencies[0].dependencies[0] dep1 = obj.dependencies[0].dependencies[1] self.assertEqual('https://example.com/foo_package@foo_version', dep0.url) self.assertEqual('https://example.com/bar_package@bar_version', dep1.url)
def _testPosixpathImpl(self): parser = gclient.OptionParser() options, _ = parser.parse_args([]) obj = gclient.GClient('src', options) cipd_root = obj.GetCipdRoot() cipd_dep = gclient.CipdDependency(parent=obj, name='src/foo/bar/baz', dep_value={ 'package': 'baz_package', 'version': 'baz_version', }, cipd_root=cipd_root, custom_vars=None, should_process=True, relative=False, condition=None) self.assertEqual(cipd_dep._cipd_subdir, 'src/foo/bar/baz')