1[tox]
2isolated_build = True
3minversion = 3.5.3
4distshare = {homedir}/.tox/distshare
5# make sure to update environment list in travis.yml and appveyor.yml
6envlist =
7    linting
8    py35
9    py36
10    py37
11    py38
12    py39
13    pypy3
14    py37-{pexpect,xdist,unittestextras,numpy,pluggymaster}
15    doctesting
16    plugins
17    py37-freeze
18    docs
19    docs-checklinks
20
21[testenv]
22commands =
23    {env:_PYTEST_TOX_COVERAGE_RUN:} pytest {posargs:{env:_PYTEST_TOX_DEFAULT_POSARGS:}}
24    doctesting: {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules --pyargs _pytest
25    coverage: coverage combine
26    coverage: coverage report -m
27passenv = USER USERNAME COVERAGE_* TRAVIS PYTEST_ADDOPTS TERM
28setenv =
29    _PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_DOCTESTING:} {env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_XDIST:}
30
31    # Configuration to run with coverage similar to CI, e.g.
32    # "tox -e py37-coverage".
33    coverage: _PYTEST_TOX_COVERAGE_RUN=coverage run -m
34    coverage: _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
35    coverage: COVERAGE_FILE={toxinidir}/.coverage
36    coverage: COVERAGE_PROCESS_START={toxinidir}/.coveragerc
37
38    doctesting: _PYTEST_TOX_POSARGS_DOCTESTING=doc/en
39
40    nobyte: PYTHONDONTWRITEBYTECODE=1
41
42    lsof: _PYTEST_TOX_POSARGS_LSOF=--lsof
43
44    xdist: _PYTEST_TOX_POSARGS_XDIST=-n auto
45extras = testing
46deps =
47    doctesting: PyYAML
48    oldattrs: attrs==17.4.0
49    oldattrs: hypothesis<=4.38.1
50    numpy: numpy
51    pexpect: pexpect
52    pluggymaster: git+https://github.com/pytest-dev/pluggy.git@master
53    pygments
54    unittestextras: twisted
55    unittestextras: asynctest
56    xdist: pytest-xdist>=1.13
57    {env:_PYTEST_TOX_EXTRA_DEP:}
58
59[testenv:linting]
60skip_install = True
61basepython = python3
62deps = pre-commit>=1.11.0
63commands = pre-commit run --all-files --show-diff-on-failure {posargs:}
64
65[testenv:mypy]
66extras = checkqa-mypy, testing
67commands = mypy {posargs:src testing}
68
69[testenv:mypy-diff]
70extras = checkqa-mypy, testing
71deps =
72    lxml
73    diff-cover
74commands =
75  -mypy --cobertura-xml-report {envtmpdir} {posargs:src testing}
76  diff-cover --fail-under=100 --compare-branch={env:DIFF_BRANCH:origin/{env:GITHUB_BASE_REF:master}} {envtmpdir}/cobertura.xml
77
78[testenv:docs]
79basepython = python3
80usedevelop = True
81deps =
82    -r{toxinidir}/doc/en/requirements.txt
83    towncrier
84commands =
85    python scripts/towncrier-draft-to-file.py
86    # the '-t changelog_towncrier_draft' tags makes sphinx include the draft
87    # changelog in the docs; this does not happen on ReadTheDocs because it uses
88    # the standard sphinx command so the 'changelog_towncrier_draft' is never set there
89    sphinx-build -W --keep-going -b html doc/en doc/en/_build/html -t changelog_towncrier_draft {posargs:}
90
91[testenv:docs-checklinks]
92basepython = python3
93usedevelop = True
94changedir = doc/en
95deps = -r{toxinidir}/doc/en/requirements.txt
96commands =
97    sphinx-build -W -q --keep-going -b linkcheck . _build
98
99[testenv:regen]
100changedir = doc/en
101basepython = python3
102passenv = SETUPTOOLS_SCM_PRETEND_VERSION
103deps =
104    dataclasses
105    PyYAML
106    regendoc>=0.6.1
107    sphinx
108whitelist_externals =
109    rm
110    make
111commands =
112    # don't show hypothesis plugin info in docs, see #4602
113    pip uninstall hypothesis -y
114    rm -rf /tmp/doc-exec*
115    rm -rf {envdir}/.pytest_cache
116    make regen
117
118[testenv:plugins]
119# use latest versions of all plugins, including pre-releases
120pip_pre=true
121# use latest pip and new dependency resolver (#7783)
122download=true
123install_command=python -m pip --use-feature=2020-resolver install {opts} {packages}
124changedir = testing/plugins_integration
125deps =
126    anyio[curio,trio]
127    django
128    pytest-asyncio
129    pytest-bdd
130    pytest-cov
131    pytest-django
132    pytest-flakes
133    pytest-html
134    pytest-mock
135    pytest-sugar
136    pytest-trio
137    pytest-twisted
138    twisted
139    pytest-xvfb
140setenv =
141    PYTHONPATH=.
142commands =
143    pip check
144    pytest bdd_wallet.py
145    pytest --cov=. simple_integration.py
146    pytest --ds=django_settings simple_integration.py
147    pytest --html=simple.html simple_integration.py
148    pytest pytest_anyio_integration.py
149    pytest pytest_asyncio_integration.py
150    pytest pytest_mock_integration.py
151    pytest pytest_trio_integration.py
152    pytest pytest_twisted_integration.py
153    pytest simple_integration.py --force-sugar --flakes
154
155[testenv:py37-freeze]
156changedir = testing/freeze
157deps =
158    pyinstaller
159commands =
160    {envpython} create_executable.py
161    {envpython} tox_run.py
162
163[testenv:release]
164decription = do a release, required posarg of the version number
165basepython = python3
166usedevelop = True
167passenv = *
168deps =
169    colorama
170    github3.py
171    pre-commit>=1.11.0
172    wheel
173    towncrier
174commands = python scripts/release.py {posargs}
175
176[testenv:release-on-comment]
177decription = do a release from a comment on GitHub
178usedevelop = {[testenv:release]usedevelop}
179passenv = {[testenv:release]passenv}
180deps = {[testenv:release]deps}
181commands = python scripts/release-on-comment.py {posargs}
182
183[testenv:publish-gh-release-notes]
184description = create GitHub release after deployment
185basepython = python3
186usedevelop = True
187passenv = GH_RELEASE_NOTES_TOKEN GITHUB_REF GITHUB_REPOSITORY
188deps =
189    github3.py
190    pypandoc
191commands = python scripts/publish-gh-release-notes.py {posargs}
192
193[flake8]
194max-line-length = 120
195extend-ignore =
196    ; whitespace before ':'
197    E203
198    ; Missing Docstrings
199    D100,D101,D102,D103,D104,D105,D106,D107
200    ; Whitespace Issues
201    D202,D203,D204,D205,D209,D213
202    ; Quotes Issues
203    D302
204    ; Docstring Content Issues
205    D400,D401,D401,D402,D405,D406,D407,D408,D409,D410,D411,D412,D413,D414,D415,D416,D417
206
207[isort]
208; This config mimics what reorder-python-imports does.
209force_single_line = 1
210known_localfolder = pytest,_pytest
211known_third_party = test_source,test_excinfo
212force_alphabetical_sort_within_sections = 1
213