Separate out functional tests

This breaks out the functional tests from the unit tests to allow running
just unit test for faster validation. Additional gate jobs will be added
to run the new functional test jobs so we don't lose that coverage, but
during development, by default only the unit tests will run.

Change-Id: I93d7216340bef70fc18fc9943da5c740ba3d4761
This commit is contained in:
Sean McGinnis 2017-06-15 19:37:27 -05:00
parent 631add1ba8
commit 466c10420b
3 changed files with 61 additions and 24 deletions

View File

@ -1,3 +1,3 @@
[DEFAULT]
test_path=${TEST_PATH:-./glance/tests}
test_path=${TEST_PATH:-./glance/tests/unit}
top_dir=./

View File

@ -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

80
tox.ini
View File

@ -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}