diff --git a/.stestr.conf b/.stestr.conf index 663a923640..b0bcaeef77 100644 --- a/.stestr.conf +++ b/.stestr.conf @@ -1,3 +1,3 @@ [DEFAULT] -test_path=${TEST_PATH:-./glance/tests} +test_path=${TEST_PATH:-./glance/tests/unit} top_dir=./ diff --git a/glance/tests/functional/db/test_registry.py b/glance/tests/functional/db/test_registry.py index 2ce5a27df1..26d7a9f680 100644 --- a/glance/tests/functional/db/test_registry.py +++ b/glance/tests/functional/db/test_registry.py @@ -17,6 +17,9 @@ from oslo_config import cfg from oslo_db import options import glance.db +# NOTE(smcginnis) Need to make sure registry opts are registered +from glance import registry # noqa +from glance.registry import client # noqa import glance.tests.functional.db as db_tests from glance.tests.functional.db import base from glance.tests.functional.db import base_metadef diff --git a/tox.ini b/tox.ini index 9e51243866..5e114da068 100644 --- a/tox.ini +++ b/tox.ini @@ -4,9 +4,8 @@ envlist = py35,py27,pep8 skipsdist = True [testenv] -basepython = - {py27,debug-py27,debug,venv,cover,docs,bandit,pep8,api-ref,genconfig,releasenotes,py27-oslo-master}: python2.7 - {py35,debug-py35,py35-oslo-master}: python3.5 +# Set default python version +basepython = python2.7 setenv = VIRTUAL_ENV={envdir} PYTHONWARNINGS=default::DeprecationWarning @@ -23,34 +22,35 @@ usedevelop = True install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} deps = -r{toxinidir}/test-requirements.txt commands = - bandit: bandit -c bandit.yaml -r glance -n5 -p gate - debug: oslo_debug_helper {posargs} - debug{-py27,-py35}: oslo_debug_helper {posargs} - docs: python setup.py build_sphinx - releasenotes: sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html - venv: {posargs} + find . -type f -name "*.pyc" -delete whitelist_externals = bash + find + rm passenv = *_proxy *_PROXY [testenv:py27] -# The periodic oslo-with-master test does not work with the -# conditionals in [testenv], use separate environment. commands = ostestr --slowest {posargs} [testenv:py35] -# The periodic oslo-with-master test does not work with the -# conditionals in [testenv], use separate environment. +basepython = python3.5 commands = ostestr --slowest {posargs} -[testenv:cover] +[testenv:functional] +# Reuse same venv as unit tests +envdir = {toxworkdir}/py27 setenv = - {[testenv]setenv} - PYTHON=coverage run --source glance --parallel-mode + TEST_PATH = ./glance/tests/functional commands = - stestr run {posargs} - coverage combine - coverage html -d cover - coverage xml -o cover/coverage.xml + ostestr {posargs} + +[testenv:functional-py35] +# Reuse same venv as unit tests +envdir = {toxworkdir}/py35 +basepython = python3.5 +setenv = + TEST_PATH = ./glance/tests/functional +commands = + ostestr '{posargs}' [testenv:pep8] commands = @@ -71,9 +71,6 @@ commands = [testenv:api-ref] # This environment is called from CI scripts to test and publish # the API Ref to developer.openstack.org. -# -whitelist_externals = bash - rm commands = rm -rf api-ref/build sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html @@ -101,3 +98,40 @@ exclude = .venv,.git,.tox,dist,doc,etc,*glance/locale*,*lib/python*,*egg,build [hacking] local-check-factory = glance.hacking.checks.factory import_exceptions = glance.i18n + +[testenv:docs] +commands = + rm -fr doc/build + python setup.py build_sphinx + +[testenv:venv] +commands = {posargs} + +[testenv:bandit] +commands = bandit -c bandit.yaml -r glance -n5 -p gate + +[testenv:releasenotes] +commands = + sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html + +[testenv:cover] +setenv = + PYTHON=coverage run --source glance --parallel-mode +commands = + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml + +[testenv:debug] +commands = + oslo_debug_helper {posargs} + +[testenv:debug-py27] +commands = + oslo_debug_helper {posargs} + +[testenv:debug-py35] +basepython = python3.5 +commands = + oslo_debug_helper {posargs}