Make tox configuration more user friendly

This commit is contained in:
Adrián Chaves 2019-11-20 07:57:09 +01:00
parent 78ad01632f
commit fc3af54dbd
3 changed files with 31 additions and 52 deletions

View File

@ -12,10 +12,9 @@ matrix:
- env: TOXENV=flake8
python: 3.8
- env: TOXENV=pypy3
python: 3.5
- env: TOXENV=py35
python: 3.5
- env: TOXENV=py35-pinned
- env: TOXENV=pinned
python: 3.5
- env: TOXENV=py36
python: 3.6
@ -23,7 +22,7 @@ matrix:
python: 3.7
- env: TOXENV=py38
python: 3.8
- env: TOXENV=py38-extra-deps
- env: TOXENV=extra-deps
python: 3.8
- env: TOXENV=docs
python: 3.6

View File

@ -202,17 +202,9 @@ tests requires `tox`_.
Running tests
-------------
Make sure you have a recent enough `tox`_ installation:
To run all tests::
``tox --version``
If your version is older than 1.7.0, please update it first:
``pip install -U tox``
To run all tests go to the root directory of Scrapy source code and run:
``tox``
tox
To run a specific test (say ``tests/test_loader.py``) use:
@ -227,7 +219,7 @@ environment name from ``tox.ini``. For example, to run the tests with Python
You can also specify a comma-separated list of environmets, and use `toxs
parallel mode`_ to run the tests on multiple environments in parallel::
tox -e py27,py36 -p auto
tox -e py37,py38 -p auto
To pass command-line options to pytest_, add them after ``--`` in your call to
tox_. Using ``--`` overrides the default positional arguments defined in

64
tox.ini
View File

@ -4,7 +4,8 @@
# and then run "tox" from this directory.
[tox]
envlist = py35
envlist = security,flake8,py3
minversion = 1.7.0
[testenv]
deps =
@ -23,11 +24,28 @@ passenv =
commands =
py.test --cov=scrapy --cov-report= {posargs:--durations=10 docs scrapy tests}
[testenv:py35]
basepython = python3.5
[testenv:security]
basepython = python3
deps =
bandit
commands =
bandit -r -c .bandit.yml {posargs:scrapy}
[testenv:py35-pinned]
basepython = python3.5
[testenv:flake8]
basepython = python3
deps =
{[testenv]deps}
pytest-flake8
commands =
py.test --flake8 {posargs:docs scrapy tests}
[testenv:pypy3]
basepython = pypy3
commands =
py.test {posargs:--durations=10 docs scrapy tests}
[testenv:pinned]
basepython = python3
deps =
-ctests/constraints.txt
cryptography==2.0
@ -48,34 +66,11 @@ deps =
botocore==1.3.23
Pillow==3.4.2
[testenv:py36]
basepython = python3.6
[testenv:py37]
basepython = python3.7
[testenv:py38]
basepython = python3.8
[testenv:pypy3]
basepython = pypy3
commands =
py.test {posargs:--durations=10 docs scrapy tests}
[testenv:security]
basepython = python3.8
deps =
bandit
commands =
bandit -r -c .bandit.yml {posargs:scrapy}
[testenv:flake8]
basepython = python3.8
[testenv:extra-deps]
deps =
{[testenv]deps}
pytest-flake8
commands =
py.test --flake8 {posargs:docs scrapy tests}
reppy
robotexclusionrulesparser
[docs]
changedir = docs
@ -99,10 +94,3 @@ changedir = {[docs]changedir}
deps = {[docs]deps}
commands =
sphinx-build -W -b linkcheck . {envtmpdir}/linkcheck
[testenv:py38-extra-deps]
basepython = python3.8
deps =
{[testenv]deps}
reppy
robotexclusionrulesparser