def ArgsForGcloud():
    """Constructs an argument list to run gcloud."""
    if not sys.executable:
        # In hermetic par/stub files sys.executable is None. In regular installs,
        # and in classic par/stub files it is a non-empty string.
        return _GetToolArgs(None, None, argv_utils.GetDecodedArgv()[0])
    return ArgsForPythonTool(config.GcloudPath())
 def testPythonArgComplete(self):
   gcloud_py_dir = os.path.dirname(config.GcloudPath())
   compdir = os.path.dirname(gcloud_py_dir)
   prog_dir = os.path.dirname(__file__)
   testfile = os.path.join(prog_dir, 'completion_test.sh')
   result = self.ExecuteScript(testfile, [compdir])
   self.assertEqual(0, result.return_code)
   # Testing /bin/zsh requires running in a local environment that has zsh
   # installed.
   if os.path.isfile('/bin/zsh') and os.access('/bin/zsh', os.X_OK):
     result = self.ExecuteScript(testfile, ['--shell=/bin/zsh', compdir])
     self.assertEqual(0, result.return_code)
Esempio n. 3
0
 def testPythonArgComplete(self):
   gcloud_py_dir = os.path.dirname(config.GcloudPath())
   compdir = os.path.dirname(gcloud_py_dir)
   prog_dir = os.path.dirname(__file__)
   testfile = os.path.join(prog_dir, 'completion_test.sh')
   exitval = execution_utils.Exec([testfile, compdir], no_exit=True)
   self.assertTrue(exitval == 0)
   # Testing /bin/zsh requires running in a local environment that has zsh
   # installed.
   if os.path.isfile('/bin/zsh') and os.access('/bin/zsh', os.X_OK):
     exitval = execution_utils.Exec([testfile, '--shell=/bin/zsh', compdir],
                                    no_exit=True)
     self.assertTrue(exitval == 0)