Add tox.ini to be able to run tests

In addition to the tox.ini, there are some more changes
to enable testing:

- require flake8 in test-requirements.txt
- fix current pep8 errors
- add .gitignore including the .tox dir

Change-Id: I4cf9d8fc1c9a2eb4929fddb4a18a7db87481017c
This commit is contained in:
Thomas Bechtold 2015-11-10 14:09:18 +01:00
parent bcdf96b638
commit 479ef07c9a
6 changed files with 56 additions and 2 deletions

18
.gitignore vendored Normal file
View File

@ -0,0 +1,18 @@
.coverage
subunit.log
.venv
*,cover
cover
.testrepository
*.pyc
.idea
*.sw?
*~
AUTHORS
build
dist
pymod2pkg.egg-info
ChangeLog
.tox
*.egg
.eggs/*

8
.testr.conf Normal file
View File

@ -0,0 +1,8 @@
[DEFAULT]
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} \
${PYTHON:-python} -m subunit.run discover -t ./ ./ $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -53,7 +53,7 @@ def openstack_prefix_tr(mod):
RDO_PKG_MAP = [
# This demonstrates per-dist filter
#SingleRule('sphinx', 'python-sphinx',
# SingleRule('sphinx', 'python-sphinx',
# distmap={'epel-6': 'python-sphinx10'}),
SingleRule('distribute', 'python-setuptools'),
SingleRule('pyopenssl', 'pyOpenSSL'),

4
test-requirements.txt Normal file
View File

@ -0,0 +1,4 @@
flake8
testrepository>=0.0.18
testresources>=0.2.4
testtools>=1.4.0

View File

@ -49,7 +49,7 @@ class Pymod2PkgTests(unittest.TestCase):
self.assertEqual(pymod2pkg.module2package('Babel', 'fedora'),
'python-babel')
self.assertEqual(pymod2pkg.module2package('nova', 'fedora'),
'openstack-nova')
'openstack-nova')
if __name__ == '__main__':

24
tox.ini Normal file
View File

@ -0,0 +1,24 @@
[tox]
envlist = py27,py33,py34,pypy,pep8
minversion = 1.6
skipsdist = True
[testenv]
usedevelop = True
install_command = pip install -U {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
OS_STDOUT_NOCAPTURE=False
OS_STDERR_NOCAPTURE=False
PYTHONHASHSEED=0
deps = -r{toxinidir}/test-requirements.txt
commands = python setup.py testr --testr-args='{posargs}'
[tox:jenkins]
downloadcache = ~/cache/pip
[testenv:pep8]
commands = flake8
[testenv:venv]
commands = {posargs}