Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Unified Diff: tools/telemetry/third_party/gsutil/third_party/apitools/apitools/gen/client_generation_test.py

Issue 1260493004: Revert "Add gsutil 4.13 to telemetry/third_party" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/third_party/gsutil/third_party/apitools/apitools/gen/client_generation_test.py
diff --git a/tools/telemetry/third_party/gsutil/third_party/apitools/apitools/gen/client_generation_test.py b/tools/telemetry/third_party/gsutil/third_party/apitools/apitools/gen/client_generation_test.py
deleted file mode 100644
index f34d95459dadaf25cd7e6ad1678fe749b9477d04..0000000000000000000000000000000000000000
--- a/tools/telemetry/third_party/gsutil/third_party/apitools/apitools/gen/client_generation_test.py
+++ /dev/null
@@ -1,72 +0,0 @@
-"""Test gen_client against all the APIs we use regularly."""
-
-import contextlib
-import logging
-import os
-import shutil
-import subprocess
-import sys
-import tempfile
-
-
-import unittest2
-
-_API_LIST = [
- 'drive.v2',
- 'bigquery.v2',
- 'compute.v1',
- 'storage.v1',
-]
-
-
-@contextlib.contextmanager
-def TempDir():
- original_dir = os.getcwd()
- path = tempfile.mkdtemp()
- try:
- os.chdir(path)
- yield path
- finally:
- os.chdir(original_dir)
- shutil.rmtree(path)
-
-
-class ClientGenerationTest(unittest2.TestCase):
-
- def setUp(self):
- super(ClientGenerationTest, self).setUp()
- self.gen_client_binary = 'gen_client'
-
- # unittest in 2.6 doesn't have skipIf.
- @unittest2.skipUnless(sys.version_info[0] == 2 and
- sys.version_info[1] == 7,
- 'Only runs in Python 2.7')
- def testGeneration(self):
- for api in _API_LIST:
- with TempDir():
- args = [
- self.gen_client_binary,
- '--client_id=12345',
- '--client_secret=67890',
- '--discovery_url=%s' % api,
- '--outdir=generated',
- '--overwrite',
- 'client',
- ]
- logging.info('Testing API %s with command line: %s',
- api, ' '.join(args))
- retcode = subprocess.call(args)
- if retcode == 128:
- logging.error('Failed to fetch discovery doc, continuing.')
- continue
- self.assertEqual(0, retcode)
-
- with tempfile.NamedTemporaryFile() as out:
- cmdline_args = [
- os.path.join(
- 'generated', api.replace('.', '_') + '.py'),
- 'help',
- ]
- retcode = subprocess.call(cmdline_args, stdout=out)
- # appcommands returns 1 on help
- self.assertEqual(1, retcode)

Powered by Google App Engine
This is Rietveld 408576698