-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtox.ini
executable file
·90 lines (74 loc) · 2.7 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#######################
# TOX CONFIGURATION #
#######################
# The list of all the test envs that will be run if you just run "tox"
[tox]
envlist = flake8,py35,py34,py33,py27,pypy2,doc,coverage,mypy,bandit
skip_missing_interpreters = True
sitepackages = False
# Default valeus for test environments. Other sections inherit from this
# and override some values for specific use cases.
[testenv]
commands = python setup.py test
deps = -r{toxinidir}/dev-requirements.txt
[testenv:pypy3]
basepython=pypy3
commands = pypy3 setup.py test
deps = -r{toxinidir}/dev-requirements.txt
# Linter check for basic errors such as missing variable declaration,
# bad imports, etc. Also check for PEP8 style compliance.
[testenv:flake8]
basepython=python
commands=flake8 {toxinidir}
deps = flake8
# Build HTML documentation from rst source
[testenv:doc]
basepython=python3.5
commands = sphinx-build -b html {toxinidir}/doc/source {toxinidir}/doc/build
deps = sphinx
# Check type hints annotations
# We ignore import errors to avoid cascading the checks on other libs
# and request to be warned if we use uneeded bypass comments.
[testenv:mypy]
basepython=python3.5
commands =
mypy {toxinidir}/tests/ --silent-imports --warn-unused-ignores --check-untyped-defs
mypy {toxinidir}/src/ --silent-imports --warn-unused-ignores --check-untyped-defs
deps = mypy-lang
setenv =
MYPYPATH = {toxinidir}/src/
# Code coverage to see how much of it we tested with py.test
[testenv:coverage]
basepython=python
commands = coverage erase
coverage run setup.py test
coverage html
coverage report
# Same version without the HTML reports to run in continuous integration envs
# such as travis
[testenv:coverage-no-report]
basepython=python
commands = coverage erase
coverage run setup.py test
#deps = -r{toxinidir}/dev-requirements.txt
# Basic security checks: passwords in code, asserts, unescaped input, etc.
[testenv:bandit]
basepython=python3.5
commands = bandit -r {toxinidir}/tests/ -s B101
bandit -r {toxinidir}/src/ww
deps = bandit
###########################
# NON TOX CONFIGURATION #
###########################
# Some softwares accept their configuration file to be the same as tox.
# Check for mccabe complexity, throws an error if we go over 10.
[flake8]
exclude = doc/*,build/*,.tox,.eggs
max-complexity = 10
# Unit tests. Check regular tests and doctests, in strict mode (all warnings
# are errors), exit on the first error, do not capture stdout to allow pdb
# debuging and print(), restart with the last failed test, show local
# variables and make it super verbose.
[pytest]
addopts = -vv --capture=no --showlocals --exitfirst --failed-first --doctest-modules src/ww tests
testpaths = tests