tooz/tox.ini
Ben Nemec 4d24f41e47 [stable-only] Cap stestr for python 2 and unblock gate
This is a combination of 3 commits that are all needed to unblock gate:

1. Move testing to py36

The base infra images no longer have python 3.5 available and are
all failing. We should be testing on py36 now anyway since that is
the minimum supported version for Train.

2. Stop redis-server before running tests

Just installing redis-server on Ubuntu Bionic starts the service,
which means when we try to start one via pifpaf it fails due to the
port already being in use.

This change adds a pre-run playbook that stops the redis-server
service so ours can run successfully.

3. [stable-only] Cap stestr for python 2

stestr dropped python 2 support with version 3.0.0 and tooz does not
use constraints from openstack/requirements, so test-requirements.txt
is updated to use stestr<3.0.0 in case of python 2.

Since tooz do not consume upper-constraints there is no need for
requirement check job either so it is removed, too.

Conflicts:
    tox.ini
    test-requirements.txt

NOTE(elod.illes):
  * tox.ini conflict is due to py37 is not yet added as tox target in
    Stein.
  * test-requirments.txt is not present in Stein, setup.cfg is used
    instead.

First two commit was squashed in train (original patch's change id is
I3f7f7ea9069d8c890a82f31ad14c9663e98c09dc and cherry picked from commit
8207427fff).

Closes-Bug: 1828610
Change-Id: I7a75be587efc2098e919f1ea34f9ffc357203dfb
(cherry picked from commit 13a6dffa32)
2020-04-16 11:56:13 +02:00

107 lines
3.3 KiB
INI

[tox]
minversion = 1.8
envlist = py27,py36,py{27,36}-{zookeeper,redis,sentinel,memcached,postgresql,mysql,consul,etcd,etcd3,etcd3gw},pep8
[testenv]
# We need to install a bit more than just `test' because those drivers have
# custom tests that we always run
deps = .[test,zake,ipc,memcached,mysql,etcd,etcd3,etcd3gw]
zookeeper: .[zookeeper]
redis: .[redis]
sentinel: .[redis]
memcached: .[memcached]
postgresql: .[postgresql]
mysql: .[mysql]
etcd: .[etcd]
etcd3: .[etcd3]
etcd3gw: .[etcd3gw]
consul: .[consul]
setenv =
TOOZ_TEST_URLS = file:///tmp zake:// ipc://
zookeeper: TOOZ_TEST_DRIVERS = zookeeper
redis: TOOZ_TEST_DRIVERS = redis
sentinel: TOOZ_TEST_DRIVERS = redis --sentinel
memcached: TOOZ_TEST_DRIVERS = memcached
mysql: TOOZ_TEST_DRIVERS = mysql
postgresql: TOOZ_TEST_DRIVERS = postgresql
etcd: TOOZ_TEST_DRIVERS = etcd,etcd --cluster
etcd3: TOOZ_TEST_DRIVERS = etcd
etcd3: TOOZ_TEST_ETCD3 = 1
etcd3gw: TOOZ_TEST_DRIVERS = etcd
etcd3gw: TOOZ_TEST_ETCD3GW = 1
consul: TOOZ_TEST_DRIVERS = consul
# NOTE(tonyb): This project has chosen to *NOT* consume upper-constraints.txt
commands =
{toxinidir}/run-tests.sh {toxinidir}/tools/pretty_tox.sh "{posargs}"
{toxinidir}/run-examples.sh
[testenv:py27]
basepython = python2.7
[testenv:venv]
basepython = python3
# This target is used by the gate go run Sphinx to build the doc
deps = {[testenv:docs]deps}
commands = {posargs}
[testenv:cover]
basepython = python3
# NOTE(bnemec): Unfortunately, referencing testenv deps doesn't work here, so
# we have to duplicate the entire list.
# See https://github.com/tox-dev/tox/issues/706
deps = .[test,zake,ipc,memcached,mysql,etcd,etcd3,etcd3gw]
zookeeper: .[zookeeper]
redis: .[redis]
sentinel: .[redis]
memcached: .[memcached]
postgresql: .[postgresql]
mysql: .[mysql]
etcd: .[etcd]
etcd3: .[etcd3]
etcd3gw: .[etcd3gw]
consul: .[consul]
coverage
setenv =
PYTHON=coverage run --source tooz --parallel-mode
TOOZ_TEST_URLS = file:///tmp zake:// ipc://
zookeeper: TOOZ_TEST_DRIVERS = zookeeper
redis: TOOZ_TEST_DRIVERS = redis
sentinel: TOOZ_TEST_DRIVERS = redis --sentinel
memcached: TOOZ_TEST_DRIVERS = memcached
mysql: TOOZ_TEST_DRIVERS = mysql
postgresql: TOOZ_TEST_DRIVERS = postgresql
etcd: TOOZ_TEST_DRIVERS = etcd,etcd --cluster
etcd3: TOOZ_TEST_DRIVERS = etcd
etcd3: TOOZ_TEST_ETCD3 = 1
etcd3gw: TOOZ_TEST_DRIVERS = etcd
etcd3gw: TOOZ_TEST_ETCD3GW = 1
consul: TOOZ_TEST_DRIVERS = consul
commands =
{toxinidir}/run-tests.sh {toxinidir}/tools/pretty_tox.sh "{posargs}"
{toxinidir}/run-examples.sh
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
[testenv:docs]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands = sphinx-build -W -b html doc/source doc/build/html
[testenv:pep8]
basepython = python3
deps = hacking<0.13,>=0.12
doc8
commands =
flake8
doc8 doc/source
[flake8]
exclude=.venv,.git,.tox,dist,*egg,*.egg-info,build,examples,doc
show-source = True
[testenv:releasenotes]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html