From 51210081a86938a35eaf066cfcfcdc7993a221c7 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sat, 7 Jan 2012 19:34:41 -0800 Subject: [PATCH] Support tox-based unittests. Change-Id: I6a0a616a979688595762e6b772d77a14f1968070 --- .gitignore | 4 ++++ tools/install_venv.py | 2 ++ tools/pip-requires | 8 -------- tools/test-requires | 10 ++++++++++ tox.ini | 37 +++++++++++++++++++++++++++++++++++++ 5 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 tools/test-requires create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 361b660d401d..5738efbd61af 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,11 @@ build-stamp nova.egg-info .nova-venv .venv +.tox *.sqlite *.log *.mo tools/conf/nova.conf* +cover/* +dist/* +.coverage diff --git a/tools/install_venv.py b/tools/install_venv.py index 90b4e60aa401..8d2d5ffb1602 100644 --- a/tools/install_venv.py +++ b/tools/install_venv.py @@ -32,6 +32,7 @@ import sys ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) VENV = os.path.join(ROOT, '.venv') PIP_REQUIRES = os.path.join(ROOT, 'tools', 'pip-requires') +TEST_REQUIRES = os.path.join(ROOT, 'tools', 'test-requires') PY_VERSION = "python%s.%s" % (sys.version_info[0], sys.version_info[1]) @@ -188,6 +189,7 @@ def install_dependencies(venv=VENV): pip_install('greenlet') pip_install('-r', PIP_REQUIRES) + pip_install('-r', TEST_REQUIRES) # Tell the virtual env how to "import nova" pthfile = os.path.join(venv, "lib", PY_VERSION, "site-packages", diff --git a/tools/pip-requires b/tools/pip-requires index 808a95530313..74cc7939e0f9 100644 --- a/tools/pip-requires +++ b/tools/pip-requires @@ -1,6 +1,4 @@ SQLAlchemy>=0.7.3 -pep8==0.6.1 -pylint==0.19 Cheetah==2.4.4 amqplib==0.6.1 anyjson==0.2.4 @@ -16,19 +14,13 @@ python-novaclient routes==1.12.3 WebOb==1.0.8 wsgiref==0.1.2 -mox==0.5.3 greenlet>=0.3.1 -nose PasteDeploy==1.5.0 paste sqlalchemy-migrate>=0.7.2 netaddr -sphinx glance -xattr>=0.6.0 suds==0.4 -coverage -nosexcover paramiko feedparser pycrypto diff --git a/tools/test-requires b/tools/test-requires new file mode 100644 index 000000000000..2395e781a9a4 --- /dev/null +++ b/tools/test-requires @@ -0,0 +1,10 @@ +# Packages needed for dev testing +distribute>=0.6.24 + +coverage +mox==0.5.3 +nose +nosexcover +openstack.nose_plugin +pep8==0.6.1 +sphinx>=1.1.2 diff --git a/tox.ini b/tox.ini new file mode 100644 index 000000000000..76c1f1ebd47e --- /dev/null +++ b/tox.ini @@ -0,0 +1,37 @@ +[tox] +envlist = py26,py27,pep8 + +[testenv] +deps = -r{toxinidir}/tools/pip-requires + -r{toxinidir}/tools/test-requires +commands = /bin/bash run_tests.sh -N -P + +[testenv:hudson] +downloadcache = ~/cache/pip + +[testenv:pep8] +deps = pep8 +commands = /bin/bash run_tests.sh -N --pep8 + +[testenv:coverage] +commands = /bin/bash run_tests.sh -N -P --coverage + +[testenv:venv] +commands = {posargs} + +[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 = /bin/bash run_tests.sh -N --coverage + +[testenv:jenkinsvenv] +deps = file://{toxinidir}/.cache.bundle +commands = {posargs} +