Merge pull request #275 from jonparrott/master

Adding travis and tox configuration to run the app engine tests
This commit is contained in:
Danny Hermes
2015-08-17 13:36:42 -07:00
5 changed files with 34 additions and 1 deletions

View File

@@ -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:

View File

@@ -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}`
fi

10
tests/data/app.yaml Normal file
View File

@@ -0,0 +1,10 @@
# Dummy app.yaml to placate nosegae.
application: oauth2client
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /.*
script: null.app

View File

@@ -26,6 +26,7 @@ import datetime
import httplib2
import json
import os
import tempfile
import time
import unittest
import urllib
@@ -58,6 +59,7 @@ from oauth2client.appengine import FlowProperty
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
@@ -240,8 +242,10 @@ class TestAppAssertionCredentials(unittest.TestCase):
self.assertEqual(None, token.expires_in)
def test_save_to_well_known_file(self):
os.environ[_CLOUDSDK_CONFIG_ENV_VAR] = tempfile.mkdtemp()
credentials = AppAssertionCredentials([])
self.assertRaises(NotImplementedError, save_to_well_known_file, credentials)
del os.environ[_CLOUDSDK_CONFIG_ENV_VAR]
class TestFlowModel(db.Model):

11
tox.ini
View File

@@ -1,5 +1,5 @@
[tox]
envlist = py26,py27,py33,py34,pypy,cover
envlist = py26,py27,py33,py34,pypy,gae,cover
[testenv]
basedeps = keyring
@@ -51,6 +51,15 @@ basepython = python2.6
deps = {[testenv]basedeps}
django>=1.5,<1.6
[testenv:gae]
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