summaryrefslogtreecommitdiff
path: root/tox.ini
blob: b1bbf3587f31ffcdc64be04dd401c7de0b1f18da (plain)
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
[tox]
minversion = 2.4
envlist = py36, py37, py38, py39, pypy, pylint, benchmark
skip_missing_interpreters = true


[testenv:pylint]
deps =
   git+https://github.com/pycqa/astroid@master
   pytest
commands =
    # This would be greatly simplified by a solution for https://github.com/PyCQA/pylint/issues/352
    pylint -rn --rcfile={toxinidir}/pylintrc --load-plugins=pylint.extensions.docparams, pylint.extensions.mccabe \
    {toxinidir}/pylint \
    {toxinidir}/tests/message/ \
    {toxinidir}/tests/checkers/ \
    {toxinidir}/tests/extensions/ \
    {toxinidir}/tests/utils/ \
    {toxinidir}/tests/acceptance/ \
    {toxinidir}/tests/conftest.py \
    {toxinidir}/tests/test_config.py \
    {toxinidir}/tests/test_func.py \
    {toxinidir}/tests/test_functional.py \
    {toxinidir}/tests/test_import_graph.py \
    {toxinidir}/tests/test_pragma_parser.py \
    {toxinidir}/tests/test_pylint_runners.py \
    {toxinidir}/tests/test_regr.py \
    {toxinidir}/tests/test_self.py \
    {toxinidir}/tests/unittest_config.py \
    {toxinidir}/tests/lint/ \
    {toxinidir}/tests/unittest_pyreverse_diadefs.py \
    {toxinidir}/tests/unittest_pyreverse_inspector.py \
    {toxinidir}/tests/unittest_pyreverse_writer.py \
    {toxinidir}/tests/unittest_reporters_json.py \
    {toxinidir}/tests/unittest_reporting.py


[testenv:formatting]
basepython = python3
deps =
    pre-commit
    sphinx
    pytest
commands =
    pre-commit run --all-files
changedir = {toxinidir}


[testenv:mypy]
basepython = python3
deps =
    pre-commit
commands =
    pre-commit run mypy --all-files


[testenv]
deps =
   https://github.com/PyCQA/astroid/tarball/master#egg=astroid
   coverage<5.0
   mccabe
   isort
   pytest
   pytest-xdist
   pytest-benchmark
   pytest-profiling
setenv =
    COVERAGE_FILE = {toxinidir}/.coverage.{envname}
commands =
    ; Run tests, ensuring all benchmark tests do not run
    python -Wignore -m coverage run -m pytest --benchmark-disable {toxinidir}/tests/ {posargs:}

    ; Transform absolute path to relative path
    ; for compatibility with coveralls.io and fix 'source not available' error.
    ; If you can find a cleaner way is welcome
    python -c "import os;cov_strip_abspath = open(os.environ['COVERAGE_FILE'], 'r').read().replace('.tox' + os.sep + os.path.relpath('{envsitepackagesdir}', '{toxworkdir}') + os.sep, '');open(os.environ['COVERAGE_FILE'], 'w').write(cov_strip_abspath)"
changedir = {toxworkdir}


[testenv:spelling]
deps =
   https://github.com/PyCQA/astroid/tarball/master#egg=astroid
   pytest
   pytest-xdist
   pyenchant
commands =
    python -Wi -m pytest {toxinidir}/tests/ {posargs:} -k unittest_spelling
changedir = {toxworkdir}


[testenv:coveralls]
setenv =
    COVERAGE_FILE = {toxinidir}/.coverage
passenv =
    *
deps =
    coverage<5.0
    coveralls
skip_install = true
commands =
    python -m coverage combine
    python -m coverage report --rcfile={toxinidir}/.coveragerc -m
    - coveralls --rcfile={toxinidir}/.coveragerc
changedir = {toxinidir}


[testenv:coverage-erase]
setenv =
    COVERAGE_FILE = {toxinidir}/.coverage
deps =
    coverage<5
skip_install = true
commands =
    python -m coverage erase
changedir = {toxinidir}


[testenv:coverage-html]
setenv =
    COVERAGE_FILE = {toxinidir}/.coverage
deps =
    coverage<5
skip_install = true
commands =
    python -m coverage combine
    python -m coverage html --ignore-errors --rcfile={toxinidir}/.coveragerc
changedir = {toxinidir}


[testenv:docs]
usedevelop = True
changedir = doc/
extras =
  docs
commands =
  sphinx-build -W -b html -d _build/doctrees . _build/html


[testenv:benchmark]
deps =
   https://github.com/PyCQA/astroid/tarball/master#egg=astroid
   coverage<5.0
   mccabe
   pytest
   pytest-xdist
   pygal
   pytest-benchmark
commands =
    ; Run the only the benchmark tests, grouping output and forcing .json output so we
    ; can compare benchmark runs
    python -Wi -m pytest --exitfirst \
                         --failed-first \
                         --benchmark-only \
                         --benchmark-save=batch_files \
                         --benchmark-save-data \
                         --benchmark-autosave \
                         {toxinidir}/tests \
                         --benchmark-group-by="group" \
                         {posargs:}

[testenv:profile_against_external]
deps =
   https://github.com/PyCQA/astroid/tarball/master#egg=astroid
   gprof2dot
   mccabe
   pytest
   pytest-profiling
   pytest-xdist
setenv =
  PYTEST_PROFILE_EXTERNAL = 1
commands =
    python -Wi -m pytest --exitfirst \
                         --profile-svg \
                         {toxinidir}/tests/profile/test_profile_against_externals.py
changedir = {toxworkdir}