c3d8c2ed96
Introduced changes: - pre-commit config and rules. - Add pre-commit to pep8 gate, Flake8 is covered in the pre-commit hooks. - Applying fixes for pre-commit compliance in all code. Also commit hash will be used instead of version tags in pre-commit to prevend arbitrary code from running in developer's machines. pre-commit will be used to: - trailing whitespace; - Replaces or checks mixed line ending (mixed-line-ending); - Forbid files which have a UTF-8 byte-order marker (check-byte-order-marker); - Checks that non-binary executables have a proper shebang (check-executables-have-shebangs); - Check for files that contain merge conflict strings (check-merge-conflict); - Check for debugger imports and py37+ breakpoint() calls in python source (debug-statements); - Attempts to load all yaml files to verify syntax (check-yaml); - Run flake8 checks (flake8) (local) For further details about tests please refer to: https://github.com/pre-commit/pre-commit-hooks Change-Id: I7a2386a823fdd43b138956894bd915c0e11289a9 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
76 lines
2.3 KiB
INI
76 lines
2.3 KiB
INI
[tox]
|
|
minversion = 3.1.0
|
|
envlist = py38,py{36,38}-{zookeeper,redis,sentinel,memcached,postgresql,mysql,consul,etcd,etcd3,etcd3gw},pep8
|
|
ignore_basepython_conflict = True
|
|
|
|
[testenv]
|
|
basepython = python3
|
|
# We need to install a bit more than just `test-requirements' because those drivers have
|
|
# custom tests that we always run
|
|
deps = .[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]
|
|
-r{toxinidir}/test-requirements.txt
|
|
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 stestr run "{posargs}"
|
|
{toxinidir}/run-examples.sh
|
|
|
|
[testenv:venv]
|
|
# This target is used by the gate go run Sphinx to build the doc
|
|
deps = {[testenv:docs]deps}
|
|
commands = {posargs}
|
|
|
|
[testenv:cover]
|
|
deps = {[testenv]deps}
|
|
setenv = {[testenv]setenv}
|
|
PYTHON=coverage run --source tooz --parallel-mode
|
|
commands =
|
|
{toxinidir}/run-tests.sh stestr run "{posargs}"
|
|
{toxinidir}/run-examples.sh
|
|
coverage combine
|
|
coverage html -d cover
|
|
coverage xml -o cover/coverage.xml
|
|
|
|
[testenv:docs]
|
|
deps = -r{toxinidir}/doc/requirements.txt
|
|
commands = sphinx-build -W -b html doc/source doc/build/html
|
|
|
|
[testenv:pep8]
|
|
deps = hacking<2.1,>=2.0
|
|
doc8
|
|
pre-commit>=2.6.0
|
|
commands =
|
|
pre-commit run -a
|
|
doc8 doc/source
|
|
|
|
[flake8]
|
|
exclude=.venv,.git,.tox,dist,*egg,*.egg-info,build,examples,doc
|
|
show-source = True
|
|
|
|
[testenv:releasenotes]
|
|
deps = -r{toxinidir}/doc/requirements.txt
|
|
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|