blob: e6e04575bbc614ca1fb11cc4436d7796f3ef8a7a [file] [log] [blame]
Alex Gaynor0f66c6d2013-08-07 12:18:02 -07001[tox]
Christian Heimesdbf18352016-11-30 13:33:02 +01002minversion = 2.4
Lucia Lic6ba99d2021-11-08 22:06:11 +08003envlist = py27,pypy,py36,py37,py38,py39,docs,pep8,packaging
4isolated_build = True
Alex Gaynor0f66c6d2013-08-07 12:18:02 -07005
6[testenv]
Chris Wolfe0b26ab22016-11-05 23:00:37 -05007extras =
Lucia Lic6ba99d2021-11-08 22:06:11 +08008 test
9 ssh: ssh
Alex Gaynor83a0f482013-08-10 15:48:57 -040010deps =
Lucia Lic6ba99d2021-11-08 22:06:11 +080011 # This must be kept in sync with .github/workflows/ci.yml
Paul Kehrer636ad602018-09-04 09:45:17 -050012 coverage
Alex Stapleton3888a842014-03-24 23:05:53 +000013 ./vectors
Lucia Lic6ba99d2021-11-08 22:06:11 +080014 randomorder: pytest-randomly
15passenv = ARCHFLAGS LDFLAGS CFLAGS INCLUDE LIB LD_LIBRARY_PATH USERNAME PYTHONIOENCODING OPENSSL_FORCE_FIPS_MODE
Alex Gaynorff61cd32013-10-03 09:52:08 -070016commands =
Paul Kehrer7cf4c302015-06-06 08:45:09 -050017 pip list
Donald Stufft62143e42014-11-13 08:17:36 -050018 # We use parallel mode and then combine here so that coverage.py will take
Lucia Lic6ba99d2021-11-08 22:06:11 +080019 # the paths like .tox/py38/lib/python3.8/site-packages/cryptography/__init__.py
Donald Stufft62143e42014-11-13 08:17:36 -050020 # and collapse them into src/cryptography/__init__.py.
21 coverage run --parallel-mode -m pytest --capture=no --strict {posargs}
22 coverage combine
Alex Gaynor3e81fb22013-11-05 16:29:19 -080023 coverage report -m
Alex Gaynor0f66c6d2013-08-07 12:18:02 -070024
Paul Kehrer63df0102017-06-19 00:59:13 -100025# This target disables coverage on pypy because of performance problems with
26# coverage.py on pypy.
27[testenv:pypy-nocoverage]
28basepython = pypy
29commands =
30 pip list
31 pytest --capture=no --strict {posargs}
32
Alex Gaynor7c8ed9e2017-08-14 23:25:01 -040033# This target disables coverage on pypy because of performance problems with
34# coverage.py on pypy.
35[testenv:pypy3-nocoverage]
36basepython = pypy3
37commands =
38 pip list
39 pytest --capture=no --strict {posargs}
40
Alex Gaynor0f66c6d2013-08-07 12:18:02 -070041[testenv:docs]
Chris Wolfe0b26ab22016-11-05 23:00:37 -050042extras =
Paul Kehrere3d2fc12018-03-05 20:50:10 -040043 docs
Chris Wolfe0b26ab22016-11-05 23:00:37 -050044 docstest
Paul Kehrer056c9dd2018-05-12 15:17:06 -040045basepython = python3
Donald Stufft235fa712013-08-11 17:47:17 -040046commands =
Lucia Lic6ba99d2021-11-08 22:06:11 +080047 sphinx-build -T -W -b html -d {envtmpdir}/doctrees docs docs/_build/html
48 sphinx-build -T -W -b latex -d {envtmpdir}/doctrees docs docs/_build/latex
49 sphinx-build -T -W -b doctest -d {envtmpdir}/doctrees docs docs/_build/html
50 sphinx-build -T -W -b spelling docs docs/_build/html
Paul Kehrerb525adf2014-09-29 15:18:23 -050051 doc8 --allow-long-titles README.rst CHANGELOG.rst docs/ --ignore-path docs/_build/
Paul Kehrer6d7b70e2018-12-02 23:50:54 +080052 python setup.py sdist
53 twine check dist/*
Alex Gaynor0f66c6d2013-08-07 12:18:02 -070054
Paul Kehrer986b1902014-03-02 16:35:21 -040055[testenv:docs-linkcheck]
Paul Kehrer562b9a92016-11-13 05:46:04 -080056extras =
Alex Gaynor9aefda92018-09-14 19:44:47 -040057 docs
Lucia Lic6ba99d2021-11-08 22:06:11 +080058basepython = python3
Paul Kehrer986b1902014-03-02 16:35:21 -040059commands =
60 sphinx-build -W -b linkcheck docs docs/_build/html
61
Alex Gaynor0f66c6d2013-08-07 12:18:02 -070062[testenv:pep8]
Terry Chiaac85fa92015-08-16 13:55:46 +080063basepython = python3
Chris Wolfe0b26ab22016-11-05 23:00:37 -050064extras =
Lucia Lic6ba99d2021-11-08 22:06:11 +080065 pep8test
Alex Gaynord8387832014-05-17 22:35:16 -070066commands =
67 flake8 .
Lucia Lic6ba99d2021-11-08 22:06:11 +080068 black --check .
Alex Gaynorc510e492013-10-31 11:37:11 -070069
Lucia Lic6ba99d2021-11-08 22:06:11 +080070[testenv:packaging]
Paul Kehrer1ecc7f12014-11-20 19:47:12 -100071deps =
Lucia Lic6ba99d2021-11-08 22:06:11 +080072 check-manifest
Paul Kehrer1ecc7f12014-11-20 19:47:12 -100073commands =
Lucia Lic6ba99d2021-11-08 22:06:11 +080074 check-manifest
Paul Kehrer1ecc7f12014-11-20 19:47:12 -100075
Alex Gaynor967c03b2013-10-21 20:22:50 -070076[flake8]
Lucia Lic6ba99d2021-11-08 22:06:11 +080077ignore = E203,E211,W503,W504
Terry Chia5cec1bf2015-03-22 11:49:08 +080078exclude = .tox,*.egg,.git,_build,.hypothesis
Alex Stapletonbafceb62014-03-22 08:50:07 +000079select = E,W,F,N,I
Alex Stapleton707b0082014-04-20 22:24:41 +010080application-import-names = cryptography,cryptography_vectors,tests
Alex Gaynor95f2c2b2014-08-19 16:18:01 -070081
82[doc8]
83extensions = rst
Terry Chia36b35b12014-12-14 15:32:16 +080084
85[pytest]
86addopts = -r s
87markers =
88 requires_backend_interface: this test requires a specific backend interface
Lucia Lic6ba99d2021-11-08 22:06:11 +080089 skip_fips: this test is not executed in FIPS mode
Terry Chia36b35b12014-12-14 15:32:16 +080090 supported: parametrized test requiring only_if and skip_message
Alex Gaynor2e85a922018-07-16 11:18:33 -040091 wycheproof_tests: this test runs a wycheproof fixture