示例#1
0
 def _check_call_svn(self, args, **kwargs):
   """Runs svn and throws an exception if the command failed."""
   kwargs.setdefault('cwd', self.project_path)
   kwargs.setdefault('stdout', self.VOID)
   kwargs.setdefault('timeout', GLOBAL_TIMEOUT)
   return subprocess2.check_call_out(
       self._add_svn_flags(args, False), **kwargs)
示例#2
0
 def _check_call_svn(self, args, **kwargs):
     """Runs svn and throws an exception if the command failed."""
     kwargs.setdefault('cwd', self.project_path)
     kwargs.setdefault('stdout', self.VOID)
     kwargs.setdefault('timeout', GLOBAL_TIMEOUT)
     return subprocess2.check_call_out(self._add_svn_flags(args, False),
                                       **kwargs)
示例#3
0
 def test_check_call_defaults(self):
     results = self._fake_communicate()
     self.assertEquals(('stdout', 'stderr'),
                       subprocess2.check_call_out(['foo'], a=True))
     expected = {
         'args': ['foo'],
         'a': True,
     }
     self.assertEquals(expected, results)
 def test_check_call_defaults(self):
   results = self._fake_communicate()
   self.assertEquals(
       ['stdout', 'stderr'], subprocess2.check_call_out(['foo'], a=True))
   expected = {
       'args': ['foo'],
       'a':True,
   }
   self.assertEquals(expected, results)
示例#5
0
 def _get_luci_auth_token(self):
   logging.debug('Running luci-auth token')
   try:
     out, err = subprocess2.check_call_out(
         ['luci-auth', 'token', '-scopes', self._scopes, '-json-output', '-'],
         stdout=subprocess2.PIPE, stderr=subprocess2.PIPE)
     logging.debug('luci-auth token stderr:\n%s', err)
     token_info = json.loads(out)
     return AccessToken(
         token_info['token'],
         datetime.datetime.utcfromtimestamp(token_info['expiry']))
   except subprocess2.CalledProcessError:
     return None
示例#6
0
 def _check_call_git(self, args, **kwargs):
   kwargs.setdefault('cwd', self.project_path)
   kwargs.setdefault('stdout', self.VOID)
   kwargs.setdefault('timeout', GLOBAL_TIMEOUT)
   return subprocess2.check_call_out(['git'] + args, **kwargs)
示例#7
0
 def _check_call_git(self, args, **kwargs):
     kwargs.setdefault('cwd', self.project_path)
     kwargs.setdefault('stdout', self.VOID)
     kwargs.setdefault('timeout', GLOBAL_TIMEOUT)
     return subprocess2.check_call_out(['git'] + args, **kwargs)
示例#8
0
 def test_check_call_defaults(self, mockCommunicate):
   mockCommunicate.return_value = (('stdout', 'stderr'), 0)
   self.assertEqual(
       ('stdout', 'stderr'), subprocess2.check_call_out(['foo'], a=True))
   mockCommunicate.assert_called_with(['foo'], a=True)