diff --git a/.gitignore b/.gitignore index 1b19277..23630d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,6 @@ .tox -tmp -build -layers -interfaces -__pycache__ -.testrepository .stestr -.pyc +*__pycache__* +*.pyc +*.swp +build diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..5fcccac --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./unit_tests +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 801646b..0000000 --- a/.testr.conf +++ /dev/null @@ -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 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..20f335d --- /dev/null +++ b/requirements.txt @@ -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 diff --git a/src/layer.yaml b/src/layer.yaml index df0afb1..349c33a 100644 --- a/src/layer.yaml +++ b/src/layer.yaml @@ -2,4 +2,4 @@ includes: - 'layer:openstack' - 'interface:cinder-backend' -repo: https://github.com/mskalka/charm-cinder-purestorage +repo: https://github.com/openstack-charmers/charm-cinder-purestorage diff --git a/test-requirements.txt b/test-requirements.txt index 9a0bed8..14b380e 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -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 -os-testr>=0.4.1 +stestr>=2.2.0 +requests>=2.18.4 charms.reactive mock>=1.2 +nose>=1.3.7 coverage>=3.6 -git+https://github.com/openstack/charms.openstack#egg=charms.openstack +git+https://github.com/openstack/charms.openstack.git#egg=charms.openstack diff --git a/tox.ini b/tox.ini index 38038ac..504ce1e 100644 --- a/tox.ini +++ b/tox.ini @@ -3,56 +3,75 @@ # within individual charm repos. [tox] skipsdist = True -envlist = pep8,py34,py35 -skip_missing_interpreters = True +envlist = pep8,py3 [testenv] setenv = VIRTUAL_ENV={envdir} PYTHONHASHSEED=0 TERM=linux LAYER_PATH={toxinidir}/layers - INTERFACE_PATH={toxinidir}/interfaces JUJU_REPOSITORY={toxinidir}/build -passenv = http_proxy https_proxy USER +passenv = http_proxy https_proxy INTERFACE_PATH install_command = pip install {opts} {packages} deps = -r{toxinidir}/requirements.txt [testenv:build] -basepython = python2.7 +basepython = python3 commands = charm-build --log-level DEBUG -o {toxinidir}/build src {posargs} -[testenv:py27] -basepython = python2.7 -# 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 +[testenv:py3] +basepython = python3 deps = -r{toxinidir}/test-requirements.txt -commands = ostestr {posargs} +commands = stestr run {posargs} [testenv:py35] basepython = python3.5 deps = -r{toxinidir}/test-requirements.txt -commands = ostestr {posargs} +commands = stestr run {posargs} [testenv:py36] basepython = python3.6 deps = -r{toxinidir}/test-requirements.txt -commands = ostestr {posargs} +commands = stestr run {posargs} [testenv:pep8] -basepython = python3.5 +basepython = python3 deps = -r{toxinidir}/test-requirements.txt 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] +basepython = python3 commands = {posargs} [flake8]