Update tox environments and test requirements

This commit is contained in:
Ryan Beisner
2019-07-09 16:12:05 -05:00
parent 7d3b847ec7
commit e392751e7c
7 changed files with 62 additions and 38 deletions

11
.gitignore vendored
View File

@@ -1,9 +1,6 @@
.tox .tox
tmp
build
layers
interfaces
__pycache__
.testrepository
.stestr .stestr
.pyc *__pycache__*
*.pyc
*.swp
build

3
.stestr.conf Normal file
View File

@@ -0,0 +1,3 @@
[DEFAULT]
test_path=./unit_tests
top_dir=./

View File

@@ -1,8 +0,0 @@
[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

7
requirements.txt Normal file
View File

@@ -0,0 +1,7 @@
# This file is managed centrally. If you find the need to modify this as a
# one-off, please don't. Intead, consult #openstack-charms and ask about
# requirements management in charms via bot-control. Thank you.
#
# Build requirements
charm-tools>=2.4.4
simplejson

View File

@@ -2,4 +2,4 @@ includes:
- 'layer:openstack' - 'layer:openstack'
- 'interface:cinder-backend' - 'interface:cinder-backend'
repo: https://github.com/mskalka/charm-cinder-purestorage repo: https://github.com/openstack-charmers/charm-cinder-purestorage

View File

@@ -1,7 +1,13 @@
# Unit test requirements # This file is managed centrally. If you find the need to modify this as a
# one-off, please don't. Intead, consult #openstack-charms and ask about
# requirements management in charms via bot-control. Thank you.
#
# Lint and unit test requirements
flake8>=2.2.4,<=2.4.1 flake8>=2.2.4,<=2.4.1
os-testr>=0.4.1 stestr>=2.2.0
requests>=2.18.4
charms.reactive charms.reactive
mock>=1.2 mock>=1.2
nose>=1.3.7
coverage>=3.6 coverage>=3.6
git+https://github.com/openstack/charms.openstack#egg=charms.openstack git+https://github.com/openstack/charms.openstack.git#egg=charms.openstack

57
tox.ini
View File

@@ -3,56 +3,75 @@
# within individual charm repos. # within individual charm repos.
[tox] [tox]
skipsdist = True skipsdist = True
envlist = pep8,py34,py35 envlist = pep8,py3
skip_missing_interpreters = True
[testenv] [testenv]
setenv = VIRTUAL_ENV={envdir} setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0 PYTHONHASHSEED=0
TERM=linux TERM=linux
LAYER_PATH={toxinidir}/layers LAYER_PATH={toxinidir}/layers
INTERFACE_PATH={toxinidir}/interfaces
JUJU_REPOSITORY={toxinidir}/build JUJU_REPOSITORY={toxinidir}/build
passenv = http_proxy https_proxy USER passenv = http_proxy https_proxy INTERFACE_PATH
install_command = install_command =
pip install {opts} {packages} pip install {opts} {packages}
deps = deps =
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
[testenv:build] [testenv:build]
basepython = python2.7 basepython = python3
commands = commands =
charm-build --log-level DEBUG -o {toxinidir}/build src {posargs} charm-build --log-level DEBUG -o {toxinidir}/build src {posargs}
[testenv:py27] [testenv:py3]
basepython = python2.7 basepython = python3
# Reactive source charms are Python3-only, but a py27 unit test target
# is required by OpenStack Governance. Remove this shim as soon as
# permitted. http://governance.openstack.org/reference/cti/python_cti.html
whitelist_externals = true
commands = true
[testenv:py34]
basepython = python3.4
deps = -r{toxinidir}/test-requirements.txt deps = -r{toxinidir}/test-requirements.txt
commands = ostestr {posargs} commands = stestr run {posargs}
[testenv:py35] [testenv:py35]
basepython = python3.5 basepython = python3.5
deps = -r{toxinidir}/test-requirements.txt deps = -r{toxinidir}/test-requirements.txt
commands = ostestr {posargs} commands = stestr run {posargs}
[testenv:py36] [testenv:py36]
basepython = python3.6 basepython = python3.6
deps = -r{toxinidir}/test-requirements.txt deps = -r{toxinidir}/test-requirements.txt
commands = ostestr {posargs} commands = stestr run {posargs}
[testenv:pep8] [testenv:pep8]
basepython = python3.5 basepython = python3
deps = -r{toxinidir}/test-requirements.txt deps = -r{toxinidir}/test-requirements.txt
commands = flake8 {posargs} src unit_tests commands = flake8 {posargs} src unit_tests
[testenv:cover]
# Technique based heavily upon
# https://github.com/openstack/nova/blob/master/tox.ini
basepython = python3
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
setenv =
{[testenv]setenv}
PYTHON=coverage run
commands =
coverage erase
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[coverage:run]
branch = True
concurrency = multiprocessing
parallel = True
source =
.
omit =
.tox/*
*/charmhelpers/*
unit_tests/*
[testenv:venv] [testenv:venv]
basepython = python3
commands = {posargs} commands = {posargs}
[flake8] [flake8]