Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Adding travis and tox configuration to run the app engine tests #275

Merged
merged 1 commit into from
Aug 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ env:
- TOX_ENV=docs
- TOX_ENV=system-tests
- TOX_ENV=system-tests3
- TOX_ENV=gae
global:
- GAE_PYTHONPATH=${HOME}/.cache/google_appengine
cache:
directories:
- ${HOME}/.cache
install:
- ./scripts/install.sh
script:
Expand Down
4 changes: 4 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ if [[ "${TOX_ENV}" == "pypy" ]]; then
pyenv install pypy-2.6.0
pyenv global pypy-2.6.0
fi

if [[ "${TOX_ENV}" == "gae" && ! -d ${GAE_PYTHONPATH} ]]; then
python scripts/fetch_gae_sdk.py `dirname ${GAE_PYTHONPATH}`

This comment was marked as spam.

fi
10 changes: 10 additions & 0 deletions tests/data/app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Dummy app.yaml to placate nosegae.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

application: oauth2client
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /.*
script: null.app
4 changes: 4 additions & 0 deletions tests/test_appengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import httplib2
import json
import os
import tempfile
import time
import unittest
import urllib
Expand Down Expand Up @@ -58,6 +59,7 @@
from oauth2client.appengine import OAuth2Decorator
from oauth2client.appengine import OAuth2DecoratorFromClientSecrets
from oauth2client.appengine import StorageByKeyName
from oauth2client.client import _CLOUDSDK_CONFIG_ENV_VAR
from oauth2client.client import AccessTokenRefreshError
from oauth2client.client import Credentials
from oauth2client.client import FlowExchangeError
Expand Down Expand Up @@ -240,8 +242,10 @@ def test_get_access_token(self):
self.assertEqual(None, token.expires_in)

def test_save_to_well_known_file(self):
os.environ[_CLOUDSDK_CONFIG_ENV_VAR] = tempfile.mkdtemp()

This comment was marked as spam.

credentials = AppAssertionCredentials([])
self.assertRaises(NotImplementedError, save_to_well_known_file, credentials)
del os.environ[_CLOUDSDK_CONFIG_ENV_VAR]


class TestFlowModel(db.Model):
Expand Down
11 changes: 10 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py26,py27,py33,py34,pypy,cover
envlist = py26,py27,py33,py34,pypy,gae,cover

[testenv]
basedeps = keyring
Expand Down Expand Up @@ -51,6 +51,15 @@ basepython = python2.6
deps = {[testenv]basedeps}
django>=1.5,<1.6

[testenv:gae]

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

basepython = python2.7
deps = {[testenv]basedeps}
nosegae
commands =
nosetests --with-gae --gae-application=tests/data --logging-level=INFO {posargs} tests/test_appengine.py
setenv:
PYTHONPATH={env:GAE_PYTHONPATH:}

[testenv:system-tests]
basepython =
python2.7
Expand Down