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

Unified Diff: dashboard/dashboard/__init__.py

Issue 2701113002: Migrate to the Google Cloud SDK. (Closed)
Patch Set: Work for both old and new SDKs. Created 3 years, 10 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
« no previous file with comments | « dashboard/bin/run_py_tests ('k') | dashboard/docs/getting-set-up.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/__init__.py
diff --git a/dashboard/dashboard/__init__.py b/dashboard/dashboard/__init__.py
index 90f226fda4453238a8e875cdab2fbcda0ace9c21..be688f1252e2230e44d3717e2288c98e9e3acb11 100644
--- a/dashboard/dashboard/__init__.py
+++ b/dashboard/dashboard/__init__.py
@@ -61,25 +61,40 @@ def PathsForDeployment():
return paths
-def ExtraPythonLibraryPaths():
+def PathsForTesting():
"""Returns a list of Python library paths required for dashboard tests."""
paths = []
paths.append(os.path.join(_CATAPULT_PATH, 'dashboard'))
- paths.extend(_AllSdkThirdPartyLibraryPaths())
- paths.extend(_CatapultThirdPartyLibraryPaths())
+ paths += _CatapultThirdPartyLibraryPaths()
+ paths += _AllSdkThirdPartyLibraryPaths()
return paths
def _AllSdkThirdPartyLibraryPaths():
- """Returns a list of all third party library paths from the SDK."""
+ """Returns a list of all third party library paths from the SDK.
+
+ The AppEngine documentation directs us to add App Engine libraries from the
+ SDK to our Python path for local unit tests.
+ https://cloud.google.com/appengine/docs/python/tools/localunittesting
+ """
+ for sdk_bin_path in os.environ['PATH'].split(os.pathsep):
+ if 'google-cloud-sdk' not in sdk_bin_path:
+ continue
+
+ appengine_path = os.path.join(
+ os.path.dirname(sdk_bin_path), 'platform', 'google_appengine')
+ sys.path.insert(0, appengine_path)
+ break
+
try:
import dev_appserver
except ImportError:
- # TODO(qyearsley): Put the App Engine SDK in the path with the
- # binary dependency manager.
+ # TODO: Put the Cloud SDK in the path with the binary dependency manager.
# https://github.com/catapult-project/catapult/issues/2135
- print 'This script requires the App Engine SDK to be in PYTHONPATH.'
+ print 'This script requires the Google Cloud SDK to be in PATH.'
+ print 'https://cloud.google.com/sdk/'
sys.exit(1)
+
return dev_appserver.EXTRA_PATHS
« no previous file with comments | « dashboard/bin/run_py_tests ('k') | dashboard/docs/getting-set-up.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698