Add support for test execution using tox

This commit is contained in:
James Page 2015-06-12 16:44:29 +01:00
parent 4754820af4
commit 49c791e5c9
6 changed files with 69 additions and 0 deletions

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} \
${PYTHON:-python} -m subunit.run discover -t ./ ./unit_tests $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

6
requirements-precise.txt Normal file
View File

@ -0,0 +1,6 @@
PyYAML==3.10
simplejson==2.3.2
netifaces==0.8
netaddr==0.7.10
Jinja2==2.6
six==1.1.0

6
requirements-trusty.txt Normal file
View File

@ -0,0 +1,6 @@
PyYAML==3.10
simplejson==3.3.1
netifaces==0.8
netaddr==0.7.10
Jinja2==2.7.2
six==1.5.2

View File

@ -0,0 +1,7 @@
testtools==0.9.35
coverage==3.7.1
mock==1.0.1
flake8==2.1.0
# No version required
testrepository
charm-tools

View File

@ -0,0 +1,7 @@
testtools==0.9.35
coverage==3.7.1
mock==1.0.1
flake8==2.1.0
# No version required
testrepository
charm-tools

35
tox.ini Normal file
View File

@ -0,0 +1,35 @@
[tox]
# Default to current LTS
envlist = lint,py27-trusty
skipsdist = True
[testenv]
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
install_command =
pip install --allow-unverified python-apt {opts} {packages}
commands = testr run {posargs}
[testenv:py27-precise]
basepython = python2.7
deps = -r{toxinidir}/requirements-precise.txt
-r{toxinidir}/test-requirements-precise.txt
[testenv:py27-trusty]
basepython = python2.7
deps = -r{toxinidir}/requirements-trusty.txt
-r{toxinidir}/test-requirements-trusty.txt
[testenv:lint]
basepython = python2.7
deps = -r{toxinidir}/requirements-trusty.txt
-r{toxinidir}/test-requirements-trusty.txt
commands = flake8 {posargs} actions hooks unit_tests tests
charm proof
[testenv:venv]
commands = {posargs}
[flake8]
ignore = E402,E226
exclude = hooks/charmhelpers