Replace test runners with nose, and add tox support.
Reviewed in: https://codereview.appspot.com/6490081/
This commit is contained in:
@@ -7,6 +7,7 @@ syntax: glob
|
|||||||
*/.git/*
|
*/.git/*
|
||||||
*/.cache/*
|
*/.cache/*
|
||||||
.gitignore
|
.gitignore
|
||||||
|
.tox
|
||||||
samples/buzz/*.dat
|
samples/buzz/*.dat
|
||||||
samples/moderator/*.dat
|
samples/moderator/*.dat
|
||||||
htmlcov/*
|
htmlcov/*
|
||||||
|
|||||||
4
Makefile
4
Makefile
@@ -4,9 +4,7 @@ pep8:
|
|||||||
APP_ENGINE_PATH=../google_appengine
|
APP_ENGINE_PATH=../google_appengine
|
||||||
|
|
||||||
test:
|
test:
|
||||||
./runtests.sh python2.6
|
tox
|
||||||
./runtests.sh python2.7
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: coverage
|
.PHONY: coverage
|
||||||
coverage:
|
coverage:
|
||||||
|
|||||||
45
runtests.py
45
runtests.py
@@ -1,45 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
import gflags
|
|
||||||
import glob
|
|
||||||
import imp
|
|
||||||
import logging
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
# import oauth2client.util for its gflags.
|
|
||||||
import oauth2client.util
|
|
||||||
|
|
||||||
from trace import fullmodname
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.CRITICAL)
|
|
||||||
|
|
||||||
FLAGS = gflags.FLAGS
|
|
||||||
|
|
||||||
APP_ENGINE_PATH='../google_appengine'
|
|
||||||
|
|
||||||
# Conditional import of cleanup function
|
|
||||||
try:
|
|
||||||
from tests.utils import cleanup
|
|
||||||
except:
|
|
||||||
def cleanup():
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Ensure current working directory is in path
|
|
||||||
sys.path.insert(0, os.getcwd())
|
|
||||||
sys.path.insert(0, APP_ENGINE_PATH)
|
|
||||||
|
|
||||||
from google.appengine.dist import use_library
|
|
||||||
use_library('django', '1.2')
|
|
||||||
|
|
||||||
|
|
||||||
def main(argv):
|
|
||||||
argv = FLAGS(argv)
|
|
||||||
for t in argv[1:]:
|
|
||||||
module = imp.load_source('test', t)
|
|
||||||
test = unittest.TestLoader().loadTestsFromModule(module)
|
|
||||||
result = unittest.TextTestRunner(verbosity=1).run(test)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main(sys.argv)
|
|
||||||
24
runtests.sh
24
runtests.sh
@@ -1,24 +0,0 @@
|
|||||||
#/bin/bash
|
|
||||||
#
|
|
||||||
# Run all the tests.
|
|
||||||
#
|
|
||||||
# The python interpreter to use is passed in on the command line.
|
|
||||||
|
|
||||||
FLAGS=--positional_parameters_enforcement=EXCEPTION
|
|
||||||
$1 runtests.py $FLAGS tests/test_discovery.py
|
|
||||||
$1 runtests.py $FLAGS tests/test_errors.py
|
|
||||||
$1 runtests.py $FLAGS tests/test_http.py
|
|
||||||
$1 runtests.py $FLAGS tests/test_json_model.py
|
|
||||||
$1 runtests.py $FLAGS tests/test_mocks.py
|
|
||||||
$1 runtests.py $FLAGS tests/test_model.py
|
|
||||||
$1 runtests.py $FLAGS tests/test_oauth2client_clientsecrets.py
|
|
||||||
$1 runtests.py $FLAGS tests/test_oauth2client_django_orm.py
|
|
||||||
$1 runtests.py $FLAGS tests/test_oauth2client_file.py
|
|
||||||
$1 runtests.py $FLAGS tests/test_oauth2client_jwt.py
|
|
||||||
$1 runtests.py $FLAGS tests/test_oauth2client.py
|
|
||||||
$1 runtests.py $FLAGS tests/test_protobuf_model.py
|
|
||||||
$1 runtests.py $FLAGS tests/test_schema.py
|
|
||||||
$1 runtests.py $FLAGS tests/test_oauth2client_appengine.py
|
|
||||||
$1 runtests.py $FLAGS tests/test_oauth2client_keyring.py
|
|
||||||
$1 runtests.py $FLAGS tests/test_oauth2client_gce.py
|
|
||||||
$1 runtests.py $FLAGS tests/test_oauth2client_xsrfutil.py
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
"""Test Package set up."""
|
||||||
|
|
||||||
|
__author__ = 'afshar@google.com (Ali Afshar)'
|
||||||
|
|
||||||
|
import gflags
|
||||||
|
|
||||||
|
def setup_package():
|
||||||
|
"""Run on testing package."""
|
||||||
|
FLAGS = gflags.FLAGS
|
||||||
|
FLAGS.positional_parameters_enforcement = 'EXCEPTION'
|
||||||
|
|||||||
@@ -29,6 +29,13 @@ import pickle
|
|||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
# Ensure that if app engine is available, we use the correct django from it
|
||||||
|
try:
|
||||||
|
from google.appengine.dist import use_library
|
||||||
|
use_library('django', '1.2')
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
from oauth2client.client import Credentials
|
from oauth2client.client import Credentials
|
||||||
from oauth2client.client import Flow
|
from oauth2client.client import Flow
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user