Exemple #1
0
 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))
Exemple #2
0
 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))
Exemple #3
0
 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 testLateOverride(self):
     """Verifies expected behavior of LateOverride."""
     url = "[email protected]:dart-lang/spark.git"
     d = gclient.Dependency(None, 'name', 'raw_url', 'url', None, None,
                            None, None, '', True, False, None, True)
     late_url = d.LateOverride(url)
     self.assertEquals(url, late_url)
 def testAutofix(self):
     # Invalid urls causes pain when specifying requirements. Make sure it's
     # auto-fixed.
     url = 'proto://host/path/@revision'
     d = gclient.Dependency(None, 'name', url, url, None, None, None, None,
                            '', True, False, None, True)
     self.assertEquals('proto://host/path@revision', d.url)
Exemple #6
0
 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)
Exemple #7
0
 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)
Exemple #8
0
 def testAutofix(self):
     # Invalid urls causes pain when specifying requirements. Make sure it's
     # auto-fixed.
     url = 'proto://host/path/@revision'
     d = gclient.Dependency(parent=None,
                            name='name',
                            url=url,
                            managed=None,
                            custom_deps=None,
                            custom_vars=None,
                            custom_hooks=None,
                            deps_file='',
                            should_process=True,
                            should_recurse=False,
                            relative=False,
                            condition=None,
                            print_outbuf=True)
     self.assertEqual('proto://host/path@revision', d.url)