summaryrefslogtreecommitdiff
path: root/tox.ini
blob: 5f512d22103ee817c00f477d6bd316ef7885db6b (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
[tox]
minversion = 3.0
envlist = formatting, py38, py39, py310, py311, pypy, benchmark
skip_missing_interpreters = true
requires = pip >=21.3.1
isolated_build = true

[testenv:pylint]
deps =
    -r {toxinidir}/requirements_test.txt
commands =
    pre-commit run pylint --all-files

[testenv:formatting]
basepython = python3
deps =
    -r {toxinidir}/requirements_test.txt
commands =
    pre-commit run --all-files

[testenv:mypy]
basepython = python3
deps =
    pre-commit~=2.20
commands =
    pre-commit run mypy --all-files

[testenv]
setenv =
    COVERAGE_FILE = {toxinidir}/.coverage.{envname}
deps =
    !pypy: -r {toxinidir}/requirements_test.txt
    pypy: -r {toxinidir}/requirements_test_min.txt
commands =
    ; Run tests, ensuring all benchmark tests do not run
    pytest --benchmark-disable {toxinidir}/tests/ {posargs:}

[testenv:spelling]
deps =
    -r {toxinidir}/requirements_test.txt
commands =
    pytest {toxinidir}/tests/ {posargs:} -k unittest_spelling

[testenv:coverage-html]
setenv =
    COVERAGE_FILE = {toxinidir}/.coverage
deps =
    -r {toxinidir}/requirements_test.txt
skip_install = true
commands =
    coverage combine
    coverage html --ignore-errors --rcfile={toxinidir}/.coveragerc

[testenv:docs]
changedir = doc/
deps =
    -r {toxinidir}/doc/requirements.txt
commands =
    # Readthedoc launch a slightly different command see '.readthedocs.yaml'
    # sphinx-build -T -W -E --keep-going -b html -d _build/doctrees -D language=en . _build/html
    # Changes were made for performance reasons, add or remove only if you can't reproduce.
    sphinx-build -T -W -j auto --keep-going -b html -d _build/doctrees -D language=en . _build/html
    # -E: don't use a saved environment, always read all files
    # -j auto: build in parallel with N processes where possible (special value "auto" will set N to cpu-count)

[testenv:test_doc]
deps =
    -r {toxinidir}/requirements_test.txt
commands =
    pytest {toxinidir}/doc/test_messages_documentation.py

[testenv:benchmark]
deps =
    -r {toxinidir}/requirements_test.txt
    pygal
commands =
    ; Run the only the benchmark tests, grouping output and forcing .json output so we
    ; can compare benchmark runs
    pytest --exitfirst \
    --failed-first \
    --benchmark-only \
    --benchmark-save=batch_files \
    --benchmark-save-data \
    --benchmark-autosave {toxinidir}/tests \
    --benchmark-group-by="group" \
    {posargs:}

[testenv:profile_against_external]
setenv =
    PYTEST_PROFILE_EXTERNAL = 1
deps =
    -r {toxinidir}/requirements_test.txt
    gprof2dot
commands =
    pytest --exitfirst \
    --profile-svg \
    {toxinidir}/tests/profile/test_profile_against_externals.py