taskflow/tox.ini
Hervé Beraud 7ab39946e7 Adding pre-commit
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: I3640bb690c552a428ae0e8250adffbc3a51a310e
Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
2020-09-08 14:33:38 +02:00

94 lines
2.4 KiB
INI

[tox]
minversion = 3.1.0
envlist = cover,docs,pep8,py38,pylint,update-states
ignore_basepython_conflict = True
[testenv]
basepython = python3
setenv =
# We need to install a bit more than just `test' because those drivers have
# custom tests that we always run
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
commands =
stestr run {posargs}
[testenv:docs]
deps =
{[testenv]deps}
-r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -E -W -b html doc/source doc/build/html
doc8 doc/source
[testenv:update-states]
deps =
{[testenv]deps}
pydot3
commands = {toxinidir}/tools/update_states.sh
[testenv:pep8]
commands = pre-commit run -a
[testenv:pylint]
deps =
{[testenv]deps}
pylint==0.26.0
commands = pylint --rcfile=pylintrc taskflow
[testenv:cover]
deps =
{[testenv]deps}
coverage>=3.6
setenv =
{[testenv]setenv}
PYTHON=coverage run --source taskflow --parallel-mode
commands =
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
[testenv:venv]
commands = {posargs}
[flake8]
builtins = _
exclude = .venv,.tox,dist,doc,*egg,.git,build,tools
ignore = E305,E402,E721,E731,E741,W503,W504
[hacking]
import_exceptions =
six.moves
taskflow.test.mock
unittest.mock
[doc8]
# Settings for doc8:
# Ignore doc/source/user/history.rst, it includes generated ChangeLog
# file that fails with "D000 Inline emphasis start-string without
# end-string."
ignore-path = doc/*/target,doc/*/build*
[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
[testenv:bindep]
# Do not install any requirements. We want this to be fast and work even if
# system dependencies are missing, since it's used to tell you what system
# dependencies are missing! This also means that bindep must be installed
# separately, outside of the requirements files, and develop mode disabled
# explicitly to avoid unnecessarily installing the checked-out repo too (this
# further relies on "tox.skipsdist = True" above).
deps = bindep
commands = bindep test
usedevelop = False
[testenv:lower-constraints]
deps =
-c{toxinidir}/lower-constraints.txt
.[test,workers,zookeeper,database,redis,eventlet]