tox.ini 4.4 KB
Newer Older
A
Aditya 已提交
1
# Tox (https://tox.readthedocs.io/) is a tool for running tests
2 3 4 5 6
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
7
envlist = security,flake8,py
8
minversion = 1.7.0
9 10

[testenv]
11
deps =
12
    -rtests/requirements-py3.txt
13 14
    # mitmproxy does not support PyPy
    # mitmproxy does not support Windows when running Python < 3.7
V
vinayak 已提交
15
    # Python 3.9+ requires https://github.com/mitmproxy/mitmproxy/commit/8e5e43de24c9bc93092b63efc67fbec029a9e7fe
16 17
    # mitmproxy >= 5.3.0 requires h2 >= 4.0, Twisted 21.2 requires h2 < 4.0
    #mitmproxy >= 5.3.0; python_version >= '3.9' and implementation_name != 'pypy'
V
vinayak 已提交
18
    mitmproxy >= 4.0.4; python_version >= '3.7' and python_version < '3.9' and implementation_name != 'pypy'
19
    mitmproxy >= 4.0.4, < 5; python_version >= '3.6' and python_version < '3.7' and platform_system != 'Windows' and implementation_name != 'pypy'
20
    # Extras
21
    botocore>=1.4.87
22
passenv =
23
    S3_TEST_FILE_URI
24 25
    AWS_ACCESS_KEY_ID
    AWS_SECRET_ACCESS_KEY
R
rhoboro 已提交
26 27
    GCS_TEST_FILE_URI
    GCS_PROJECT_ID
28
#allow tox virtualenv to upgrade pip/wheel/setuptools
29
download = true
30
commands =
31
    py.test --cov=scrapy --cov-report=xml --cov-report= {posargs:--durations=10 docs scrapy tests}
32 33
install_command =
    pip install -U -ctests/upper-constraints.txt {opts} {packages}
34

E
Eugenio Lacuesta 已提交
35 36 37 38 39 40 41
[testenv:typing]
basepython = python3
deps =
    mypy==0.780
commands =
    mypy {posargs: scrapy tests}

42 43 44 45 46 47
[testenv:security]
basepython = python3
deps =
    bandit
commands =
    bandit -r -c .bandit.yml {posargs:scrapy}
D
Daniel Graña 已提交
48

49 50 51 52 53 54 55
[testenv:flake8]
basepython = python3
deps =
    {[testenv]deps}
    pytest-flake8
commands =
    py.test --flake8 {posargs:docs scrapy tests}
56

A
Adrián Chaves 已提交
57 58 59 60 61 62 63 64 65 66 67 68
[testenv:pylint]
basepython = python3
deps =
    {[testenv]deps}
    # Optional dependencies
    boto
    reppy
    robotexclusionrulesparser
    # Test dependencies
    pylint
commands =
    pylint conftest.py docs extras scrapy setup.py tests
69

70
[pinned]
71
deps =
72
    cryptography==2.0
73
    cssselect==0.9.1
74
    h2==3.0
75
    itemadapter==0.1.0
76
    parsel==1.5.0
V
Vostretsov Nikita 已提交
77
    Protego==0.1.15
78
    pyOpenSSL==16.2.0
79 80
    queuelib==1.4.2
    service_identity==16.0.0
81
    Twisted[http2]==17.9.0
82
    w3lib==1.17.0
83
    zope.interface==4.1.3
84
    -rtests/requirements-py3.txt
85 86 87 88

    # mitmproxy 4.0.4+ requires upgrading some of the pinned dependencies
    # above, hence we do not install it in pinned environments at the moment

89
    # Extras
90
    botocore==1.4.87
91
    google-cloud-storage==1.29.0
92
    Pillow==4.0.0
93
setenv =
A
Adrián Chaves 已提交
94
    _SCRAPY_PINNED=true
95 96
install_command =
    pip install -U {opts} {packages}
97

98 99 100
[testenv:pinned]
deps =
    {[pinned]deps}
D
dswij 已提交
101
    lxml==3.5.0
102
    PyDispatcher==2.0.5
103
install_command = {[pinned]install_command}
104 105
setenv =
    {[pinned]setenv}
106

107 108 109 110
[testenv:windows-pinned]
basepython = python3
deps =
    {[pinned]deps}
111
    # First lxml version that includes a Windows wheel for Python 3.6, so we do
112 113
    # not need to build lxml from sources in a CI Windows job:
    lxml==3.8.0
114
    PyDispatcher==2.0.5
115
install_command = {[pinned]install_command}
116 117
setenv =
    {[pinned]setenv}
118

119
[testenv:extra-deps]
M
Marc Hernández 已提交
120 121
deps =
    {[testenv]deps}
122 123
    reppy
    robotexclusionrulesparser
124
    Pillow>=4.0.0
M
Marc Hernández 已提交
125

126 127 128 129 130
[testenv:asyncio]
commands =
    {[testenv]commands} --reactor=asyncio

[testenv:asyncio-pinned]
D
dswij 已提交
131
deps = {[testenv:pinned]deps}
132
commands = {[testenv:asyncio]commands}
133
install_command = {[pinned]install_command}
134 135
setenv =
    {[pinned]setenv}
136 137 138 139 140 141 142 143 144 145 146

[testenv:pypy3]
basepython = pypy3
commands =
    py.test {posargs:--durations=10 docs scrapy tests}

[testenv:pypy3-pinned]
basepython = {[testenv:pypy3]basepython}
deps =
    {[pinned]deps}
    lxml==4.0.0
D
dswij 已提交
147 148
    PyPyDispatcher==2.1.0
commands = {[testenv:pypy3]commands}
149
install_command = {[pinned]install_command}
150 151
setenv =
    {[pinned]setenv}
152

153
[docs]
J
Julia Medina 已提交
154 155
changedir = docs
deps =
H
harshasrinivas 已提交
156
    -rdocs/requirements.txt
A
Adrián Chaves 已提交
157 158 159
setenv =
    READTHEDOCS_PROJECT=scrapy
    READTHEDOCS_VERSION=master
160 161

[testenv:docs]
162
basepython = python3
163 164
changedir = {[docs]changedir}
deps = {[docs]deps}
A
Adrián Chaves 已提交
165
setenv = {[docs]setenv}
J
Julia Medina 已提交
166
commands =
167
    sphinx-build -W -b html . {envtmpdir}/html
168

169
[testenv:docs-coverage]
170
basepython = python3
171 172
changedir = {[docs]changedir}
deps = {[docs]deps}
A
Adrián Chaves 已提交
173
setenv = {[docs]setenv}
174 175 176
commands =
    sphinx-build -b coverage . {envtmpdir}/coverage

177
[testenv:docs-links]
178
basepython = python3
179 180
changedir = {[docs]changedir}
deps = {[docs]deps}
A
Adrián Chaves 已提交
181
setenv = {[docs]setenv}
182
commands =
183
    sphinx-build -W -b linkcheck . {envtmpdir}/linkcheck