From 6d67b4a6a24a9ed7eade711dd4f72bc3668dd6b4 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Wed, 21 Mar 2012 10:34:46 -0400 Subject: [PATCH] Updated tox.ini to work properly with Jenkins. As part of doing that, fixed a unittest to work with python2.6. Change-Id: I575a8534bf008077c1a24a25336f1d711f742297 --- setup.cfg | 1 - setup.py | 28 ++++++++++++++-------------- tests/v2_0/test_auth.py | 7 ++++++- tools/pip-requires | 1 + tox.ini | 34 ++++++++++++++++++++++++++++------ 5 files changed, 49 insertions(+), 22 deletions(-) diff --git a/setup.cfg b/setup.cfg index 15da16723..778428301 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,5 @@ [nosetests] cover-package = keystoneclient -cover-html = true cover-erase = true cover-inclusive = true diff --git a/setup.py b/setup.py index 1980746f3..ed6e7be37 100644 --- a/setup.py +++ b/setup.py @@ -13,16 +13,16 @@ if sys.version_info < (2, 7): requirements.append('argparse') setup( - name = "python-keystoneclient", - version = "2012.1", - description = "Client library for OpenStack Keystone API", - long_description = read('README.rst'), - url = 'https://github.com/openstack/python-keystoneclient', - license = 'Apache', - author = 'Nebula Inc, based on work by Rackspace and Jacob Kaplan-Moss', - author_email = 'gabriel.hurley@nebula.com', - packages = find_packages(exclude=['tests', 'tests.*']), - classifiers = [ + name="python-keystoneclient", + version="2012.1", + description="Client library for OpenStack Keystone API", + long_description=read('README.rst'), + url='https://github.com/openstack/python-keystoneclient', + license='Apache', + author='Nebula Inc, based on work by Rackspace and Jacob Kaplan-Moss', + author_email='gabriel.hurley@nebula.com', + packages=find_packages(exclude=['tests', 'tests.*']), + classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Console', 'Intended Audience :: Developers', @@ -31,12 +31,12 @@ setup( 'Operating System :: OS Independent', 'Programming Language :: Python', ], - install_requires = requirements, + install_requires=requirements, - tests_require = ["nose", "mock", "mox"], - test_suite = "nose.collector", + tests_require=["nose", "mock", "mox"], + test_suite="nose.collector", - entry_points = { + entry_points={ 'console_scripts': ['keystone = keystoneclient.shell:main'] } ) diff --git a/tests/v2_0/test_auth.py b/tests/v2_0/test_auth.py index f9f90d417..8dc4c112c 100644 --- a/tests/v2_0/test_auth.py +++ b/tests/v2_0/test_auth.py @@ -78,12 +78,17 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase): .AndReturn((resp, resp['body'])) self.mox.ReplayAll() - with self.assertRaises(exceptions.Unauthorized): + # Workaround for issue with assertRaises on python2.6 + # where with assertRaises(exceptions.Unauthorized): doesn't work + # right + def client_create_wrapper(): client.Client(username=self.TEST_USER, password="bad_key", tenant_id=self.TEST_TENANT_ID, auth_url=self.TEST_URL) + self.assertRaises(exceptions.Unauthorized, client_create_wrapper) + def test_auth_redirect(self): correct_response = json.dumps(self.TEST_RESPONSE_DICT) dict_responses = [ diff --git a/tools/pip-requires b/tools/pip-requires index af3712df4..9aa889e0b 100644 --- a/tools/pip-requires +++ b/tools/pip-requires @@ -4,6 +4,7 @@ httplib2 mock mox nose +nosexcover pep8 prettytable simplejson diff --git a/tox.ini b/tox.ini index c81dd64d8..554c78bb6 100644 --- a/tox.ini +++ b/tox.ini @@ -1,14 +1,36 @@ [tox] -envlist = py26,py27 +envlist = py26,py27,pep8 [testenv] +setenv = VIRTUAL_ENV={envdir} deps = -r{toxinidir}/tools/pip-requires -commands = /bin/bash run_tests.sh -N +commands = nosetests {posargs} [testenv:pep8] deps = pep8 -commands = /bin/bash run_tests.sh -N --pep8 +commands = pep8 --repeat --show-source keystoneclient setup.py -[testenv:coverage] -deps = pep8 -commands = /bin/bash run_tests.sh -N --with-coverage +[testenv:cover] +commands = nosetests --with-xcoverage {posargs} + +[testenv:venv] +commands = {posargs} + +[testenv:hudson] +downloadcache = ~/cache/pip + +[testenv:jenkins26] +basepython = python2.6 +deps = file://{toxinidir}/.cache.bundle + +[testenv:jenkins27] +basepython = python2.7 +deps = file://{toxinidir}/.cache.bundle + +[testenv:jenkinscover] +deps = file://{toxinidir}/.cache.bundle +commands = nosetests --with-xcoverage {posargs} + +[testenv:jenkinsvenv] +deps = file://{toxinidir}/.cache.bundle +commands = {posargs}