[GO] Library path setting to pass GAE / Python local unit tests

Overview

One of the development PCs is brew-cask with google-cloud-sdk installed on Mac OS X, the other is apt-get with google-cloud-sdk-app-engine-python installed on Bash on Ubuntu on I want to manage PYTHONPATH for unit test to run locally in the chaotic environment of Windows.

environment

Python 2.7

manner

Since the setting information is returned by json with gcloud info --format = json, get sdk_root from there.

import os, sys, subprocess, json
gcloud_info = json.loads(subprocess.check_output(['gcloud', 'info', '--format=json']))
sdk_path = os.path.join(gcloud_info["installation"]["sdk_root"], 'platform', 'google_appengine')
sys.path.append(sdk_path)
sys.path.append(os.path.join(sdk_path, 'lib', 'yaml', 'lib'))

Recommended Posts

Library path setting to pass GAE / Python local unit tests
Python unit tests
Setting to pass local proxy only for specific site
Pass OpenCV data from the original C ++ library to Python
How to pass VScode + WSL + Python Path (Unable to import ~ "xxx" solution)
[Beginner memo] How to specify the library reading path in Python
Introduction to Python Numerical Library NumPy
[Python] How to import the library
Write C unit tests in Python
Pharmaceutical company researchers summarized Python unit tests
Pass the path of the imported python module
Output Python log to console with GAE
Get the path to the systemd unit file
[Python / Tkinter] How to pass arguments to command
Introduce Python library TRML2PDF to MacOSX (10.11.xx)
"How to pass PATH" to learn with homebrew
Python) Save scraping content to local PC
How to pass the path to the library built with pyenv and virtualenv in PyCharm