summaryrefslogtreecommitdiff
path: root/tox.ini
blob: 60f133cea9162fc72afed52e31d35d5cb2d7a880 (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
[tox]
minversion = 3.4.0
envlist =
    docs, packaging, lint, vendoring,
    py36, py37, py38, py39, pypy3

[helpers]
# Wrapper for calls to pip that make sure the version being used is the
# original virtualenv (stable) version, and not the code being tested.
pip = python {toxinidir}/tools/tox_pip.py
mkdirp = python -c 'import os, sys; os.path.exists(sys.argv[1]) or os.mkdir(sys.argv[1])'

[testenv]
# Remove USERNAME once we drop PY2.
passenv =
    CI
    GIT_SSL_CAINFO
    USERNAME
    HTTP_PROXY
    HTTPS_PROXY
    NO_PROXY
setenv =
    # This is required in order to get UTF-8 output inside of the subprocesses
    # that our tests use.
    LC_CTYPE = en_US.UTF-8
deps = -r{toxinidir}/tools/requirements/tests.txt
commands_pre =
    python -c 'import shutil, sys; shutil.rmtree(sys.argv[1], ignore_errors=True)' {toxinidir}/tests/data/common_wheels
    {[helpers]pip} wheel -w {toxinidir}/tests/data/common_wheels -r {toxinidir}/tools/requirements/tests-common_wheels.txt
commands = pytest []
install_command = {[helpers]pip} install {opts} {packages}
list_dependencies_command = {[helpers]pip} freeze --all

[testenv:coverage]
basepython = python3
commands =
    {[helpers]mkdirp} {toxinidir}/.coverage-output
    pytest --cov=pip --cov-config={toxinidir}/setup.cfg []

setenv =
    # Used in coverage configuration in setup.cfg.
    COVERAGE_OUTPUT_DIR = {toxinidir}/.coverage-output
    # Ensure coverage is enabled in child processes in virtual environments
    # since they won't already have been enabled by pytest-cov.
    COVERAGE_PROCESS_START = {toxinidir}/setup.cfg
    # Used in coverage configuration in setup.cfg.
    PIP_CI_COVERAGE_EXCLUDES = if PY2

[testenv:docs]
# Don't skip install here since pip_sphinxext uses pip's internals.
deps = -r{toxinidir}/tools/requirements/docs.txt
basepython = python3
commands =
    sphinx-build -W -j auto -d {envtmpdir}/doctrees/html -b html docs/html docs/build/html
    # Having the conf.py in the docs/html is weird but needed because we
    # can not use a different configuration directory vs source directory on RTD
    # currently -- https://github.com/rtfd/readthedocs.org/issues/1543.
    # That is why we have a "-c docs/html" in the next line.
    sphinx-build -W -j auto -d {envtmpdir}/doctrees/man -b man docs/man docs/build/man -c docs/html

[testenv:lint]
skip_install = True
commands_pre =
deps = pre-commit
commands =
   pre-commit run [] --all-files --show-diff-on-failure --hook-stage=manual

[testenv:vendoring]
basepython = python3
skip_install = True
commands_pre =
deps =
    vendoring~=0.3.3
    # Required, otherwise we interpret --no-binary :all: as
    # "do not build wheels", which fails for PEP 517 requirements
    pip>=19.3.1
whitelist_externals = git
commands =
    # Check that the vendoring is up-to-date
    vendoring sync . -v
    git diff --exit-code