summaryrefslogtreecommitdiff
path: root/tox.ini
blob: 33de1aa26a69b8de0ee28403f4ad24711c440d8f (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
[tox]
envlist =
    py{36,37,38,39,py3}-{noextra,format,format_nongpl}-{build,tests},
    readme
    safety
    secrets
    style
    docs-{html,doctest,linkcheck,spelling,style}
skipsdist = True

[testenv]
changedir = {envtmpdir}
passenv = CODECOV* CI
setenv =
    JSON_SCHEMA_TEST_SUITE = {toxinidir}/json
    tests: PYTHONWARNINGS = error,ignore:Creating a LegacyVersion:DeprecationWarning,ignore:SelectableGroups dict interface:DeprecationWarning,ignore:":UserWarning,ignore:the imp module:DeprecationWarning

    coverage,codecov: MAYBE_COVERAGE = coverage run -m
    coverage,codecov: COVERAGE_RCFILE={toxinidir}/.coveragerc
    coverage,codecov: COVERAGE_DEBUG_FILE={envtmpdir}/coverage-debug
    coverage,codecov: COVERAGE_FILE={envtmpdir}/coverage-data
whitelist_externals =
    mkdir
commands =
    {envpython} -m pip install 'pip>=21.1.1'  # Evade CVE-2021-28363

    # Remove once pypa/pip#7555 is closed.
    noextra: {envpython} -m pip install --use-feature=in-tree-build {toxinidir}
    format,perf: {envpython} -m pip install  --use-feature=in-tree-build '{toxinidir}[format]'
    format_nongpl: {envpython} -m pip install --use-feature=in-tree-build '{toxinidir}[format_nongpl]'

    tests,coverage,codecov: {envpython} -m {env:MAYBE_COVERAGE:} twisted.trial {posargs:jsonschema}
    tests: {envpython} -m doctest {toxinidir}/README.rst

    coverage: {envpython} -m coverage report --show-missing
    coverage: {envpython} -m coverage html --directory={envtmpdir}/htmlcov
    codecov: {envpython} -m coverage xml -o {envtmpdir}/coverage.xml
    codecov: codecov --required --disable gcov --file {envtmpdir}/coverage.xml

    perf: mkdir {envtmpdir}/benchmarks/
    perf: {envpython} {toxinidir}/jsonschema/benchmarks/issue232.py --inherit-environ JSON_SCHEMA_TEST_SUITE --output {envtmpdir}/benchmarks/issue232.json
    perf: {envpython} {toxinidir}/jsonschema/benchmarks/json_schema_test_suite.py --inherit-environ JSON_SCHEMA_TEST_SUITE --output {envtmpdir}/benchmarks/json_schema_test_suite.json

    build: {envpython} -m build {toxinidir} --outdir {envtmpdir}/dist
deps =
    build: build

    perf: pyperf

    tests,coverage,codecov: twisted

    coverage,codecov: coverage
    codecov: codecov

[testenv:bandit]
deps = bandit
commands = {envbindir}/bandit --recursive {toxinidir}/jsonschema

[testenv:readme]
deps =
    build
    docutils
    twine
commands =
    {envpython} -m build --outdir {envtmpdir}/dist {toxinidir}
    {envpython} -m twine check {envtmpdir}/dist/*
    {envbindir}/rst2html5.py --halt=warning {toxinidir}/CHANGELOG.rst /dev/null

[testenv:safety]
deps = safety
commands =
    {envpython} -m pip install 'pip>=21.1.1'  # Evade CVE-2021-28363

    # Remove once pypa/pip#7555 is closed.
    {envpython} -m pip install --use-feature=in-tree-build '{toxinidir}[format]'

    {envpython} -m safety check

[testenv:secrets]
deps = detect-secrets
commands = {envbindir}/detect-secrets scan {toxinidir}

[testenv:style]
deps =
    flake8
    flake8-commas
commands =
    {envpython} -m flake8 {posargs} {toxinidir}/jsonschema {toxinidir}/docs

[testenv:docs-html]
commands = {envpython} -m sphinx -b html {toxinidir}/docs/ {envtmpdir}/build {posargs:-a -n -q -T -W}
deps =
    -r{toxinidir}/docs/requirements.txt
    {toxinidir}

[testenv:docs-doctest]
commands = {envpython} -m sphinx -b doctest {toxinidir}/docs/ {envtmpdir}/build {posargs:-a -n -q -T -W}
deps =
    -r{toxinidir}/docs/requirements.txt
    {toxinidir}

[testenv:docs-linkcheck]
commands = {envpython} -m sphinx -b linkcheck {toxinidir}/docs/ {envtmpdir}/build {posargs:-a -n -q -T -W}
deps =
    -r{toxinidir}/docs/requirements.txt
    {toxinidir}

[testenv:docs-spelling]
commands = {envpython} -m sphinx -b spelling {toxinidir}/docs/ {envtmpdir}/build {posargs:-a -n -T -W}
deps =
    -r{toxinidir}/docs/requirements.txt
    {toxinidir}

[testenv:docs-style]
commands = doc8 {posargs} {toxinidir}/docs
deps =
    doc8
    pygments
    pygments-github-lexers