Skip to content

Latest commit

 

History

History
68 lines (52 loc) · 2.75 KB

README.rst

File metadata and controls

68 lines (52 loc) · 2.75 KB

Run tests locally

  1. Copy settings files to the pydrive2/test/settings/local directory:
cd pydrive2/test/settings && cp *.yaml local
  1. Setup a Google service account for your Google Cloud Project:
    • Sign into the Google API Console
    • Select or Create a new project.
    • Enable the Drive API from the APIs & Services Dashboard (left sidebar), click on + ENABLE APIS AND SERVICES. Find and select the "Google Drive API" in the API Library, and click on the ENABLE button.
    • Go back to IAM & Admin in the left sidebar, and select Service Accounts. Click + CREATE SERVICE ACCOUNT, on the next screen, enter Service account name e.g. "PyDrive tests", and click Create. Select Continue at the next Service account permissions page, click at + CREATE KEY, select JSON and Create. Save generated .json key file at your local disk.
    • Copy downloaded json file to /tmp/pydrive2/credentials.json directory.
  2. Optional. If you would like to use your own an OAuth client ID follow the steps:
    • Under Google API Console select APIs & Services from the left sidebar, and select OAuth consent screen. Chose a User Type and click CREATE. On the next screen, enter an Application name e.g. "PyDrive tests", and click the Save (scroll to bottom).
    • From the left sidebar, select Credentials, and click the Create credentials dropdown to select OAuth client ID. Chose Other and click Create to proceed with a default client name. At Credentials screen find a list of your OAuth 2.0 Client IDs, click download icon in front of your OAuth client id created previously. You should be prompted to download client_secret_xxx_.json file.
    • Copy downloaded .json file into pydrive2/test directory and rename to client_secrets.json.
    • Replace {{ }} sections in pydrive2/test/settings/local/test_oauth_test_02.yaml with the relevant values of client_id and client_secret from your client_secrets.json file.
  3. Setup virtual environment (recommended optional step):
virtualenv -p python .env
source .env/bin/activate
  1. Install tests deps from the root directory of the project:
pip install -e .[tests,fsspec]
  1. Run tests:
py.test -v -s