Add tox config for multi-python testing.

Change-Id: I59ba68ae7fd9d92bd914716a8bdd14d702fd38b0
This commit is contained in:
Monty Taylor 2012-02-06 08:35:10 -05:00
parent 20f8c55630
commit 420e8836a5
9 changed files with 79 additions and 27 deletions

3
.gitignore vendored
View File

@ -6,8 +6,11 @@ build/*
build-stamp build-stamp
melange.egg-info melange.egg-info
.melange-venv .melange-venv
.tox
.venv .venv
*.sqlite *.sqlite
*.log *.log
tags tags
*~ *~
ChangeLog
melange/vcsversion.py

View File

@ -4,6 +4,8 @@ include ChangeLog MANIFEST.in pylintrc Authors
include melange/db/sqlalchemy/migrate_repo/migrate.cfg include melange/db/sqlalchemy/migrate_repo/migrate.cfg
include melange/db/sqlalchemy/migrate_repo/README include melange/db/sqlalchemy/migrate_repo/README
include melange/db/sqlalchemy/migrate_repo/versions/*.sql include melange/db/sqlalchemy/migrate_repo/versions/*.sql
include requirements.txt
include tools/*
graft doc graft doc
graft tools graft tools
graft etc graft etc

View File

@ -1,20 +0,0 @@
#!/bin/sh
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# 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.
dpkg-buildpackage -b -rfakeroot -tc -uc -D

View File

@ -22,3 +22,15 @@ keywords = _ l_ lazy_gettext
mapping_file = babel.cfg mapping_file = babel.cfg
output_file = locale/melange.pot output_file = locale/melange.pot
[nosetests]
# NOTE(jkoelker) To run the test suite under nose install the following
# coverage http://pypi.python.org/pypi/coverage
# tissue http://pypi.python.org/pypi/tissue (pep8 checker)
# openstack-nose https://github.com/jkoelker/openstack-nose
verbosity=2
detailed-errors=1
with-openstack=1
openstack-red=0.05
openstack-yellow=0.025
openstack-show-elapsed=1
openstack-color=1

View File

@ -27,6 +27,10 @@ from setuptools import setup
gettext.install('melange', unicode=1) gettext.install('melange', unicode=1)
from melange.openstack.common.setup import parse_mailmap, str_dict_replace from melange.openstack.common.setup import parse_mailmap, str_dict_replace
from melange.openstack.common.setup import parse_requirements
from melange.openstack.common.setup import parse_dependency_links
from melange.openstack.common.setup import write_requirements
from melange import version from melange import version
@ -93,6 +97,12 @@ try:
except: except:
pass pass
requires = parse_requirements(['requirements.txt', 'tools/pip-requires'])
depend_links = parse_dependency_links(['requirements.txt',
'tools/pip-requires'])
write_requirements()
setup(name='melange', setup(name='melange',
version=version.canonical_version_string(), version=version.canonical_version_string(),
@ -103,6 +113,8 @@ setup(name='melange',
cmdclass=cmdclass, cmdclass=cmdclass,
packages=find_packages(exclude=['bin']), packages=find_packages(exclude=['bin']),
include_package_data=True, include_package_data=True,
install_requires=requires,
dependency_links=depend_links,
test_suite='nose.collector', test_suite='nose.collector',
classifiers=[ classifiers=[
'Development Status :: 4 - Beta', 'Development Status :: 4 - Beta',

View File

@ -31,6 +31,7 @@ import sys
ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
VENV = os.path.join(ROOT, '.venv') VENV = os.path.join(ROOT, '.venv')
PIP_REQUIRES = os.path.join(ROOT, 'tools', 'pip-requires') 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]) PY_VERSION = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
@ -103,8 +104,9 @@ def install_dependencies(venv=VENV):
# get it in stalled in the right order # get it in stalled in the right order
run_command(['tools/with_venv.sh', 'pip', 'install', '-E', venv, run_command(['tools/with_venv.sh', 'pip', 'install', '-E', venv,
'greenlet'], redirect_output=False) 'greenlet'], redirect_output=False)
run_command(['tools/with_venv.sh', 'pip', 'install', '-E', venv, '-r', for requires in (PIP_REQUIRES, TEST_REQUIRES):
PIP_REQUIRES], redirect_output=False) run_command(['tools/with_venv.sh', 'pip', 'install', '-E', venv, '-r',
requires], redirect_output=False)
# Tell the virtual env how to "import melange" # Tell the virtual env how to "import melange"
pthfile = os.path.join(venv, "lib", PY_VERSION, "site-packages", pthfile = os.path.join(venv, "lib", PY_VERSION, "site-packages",

View File

@ -1,19 +1,14 @@
SQLAlchemy SQLAlchemy
pep8
pylint
eventlet eventlet
kombu==1.0.4 kombu==1.0.4
routes routes
WebOb WebOb
mox mox
nose
PasteDeploy PasteDeploy
paste paste
sqlalchemy-migrate sqlalchemy-migrate
netaddr netaddr
sphinx sphinx
coverage
nosexcover
webtest webtest
factory_boy factory_boy
httplib2 httplib2

9
tools/test-requires Normal file
View File

@ -0,0 +1,9 @@
# Packages needed for dev testing
distribute>=0.6.24
coverage
nose
nosexcover
openstack.nose_plugin
pep8
pylint

37
tox.ini Normal file
View File

@ -0,0 +1,37 @@
[tox]
envlist = py26,py27,pep8
[testenv]
setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/tools/pip-requires
commands = nosetests
[testenv:pep8]
deps = pep8
commands = pep8 --repeat --show-source bin melange setup.py
[testenv:pylint]
deps = pylint
commands = pylint --rcfile=pylintrc --output-format=parseable melange
[testenv:cover]
commands = nosetests --with-coverage --cover-html --cover-erase --cover-package=melange
[testenv:sdist]
commands = python setup.py sdist {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 --cover-erase --cover-package=melange --with-xcoverage