summaryrefslogtreecommitdiff
path: root/tox.ini
blob: d33e3eacdb8d8d4a06e5ca0914b801f001c07243 (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
[tox]
min_version = 4.0.9
envlist =
    py{38,39,310,311,py3}-{noextra,format,formatnongpl}-{build,tests}
    {noextra,format,formatnongpl}-audit
    readme
    secrets
    style
    typing
    docs-{dirhtml,doctest,linkcheck,spelling,style}
skipsdist = True

[testenv]
changedir = {envtmpdir}
passenv = CI, GITHUB_STEP_SUMMARY, PYTHONUTF8
setenv =
    PIP_DISABLE_PIP_VERSION_CHECK = 1

    JSON_SCHEMA_TEST_SUITE = {toxinidir}/json

    coverage,ghcoverage: MAYBE_COVERAGE=coverage run -m
    coverage,ghcoverage: COVERAGE_RCFILE={toxinidir}/.coveragerc
    coverage,ghcoverage: COVERAGE_DEBUG_FILE={envtmpdir}/coverage-debug
    coverage,ghcoverage: COVERAGE_FILE={envtmpdir}/coverage-data
allowlist_externals =
    mkdir
    sh
commands =
    noextra: {envpython} -m pip install --quiet {toxinidir}
    format,perf: {envpython} -m pip install --quiet '{toxinidir}[format]'
    formatnongpl: {envpython} -m pip install --quiet '{toxinidir}[format-nongpl]'

    audit: {envpython} -m pip_audit
    audit-formatnongpl: {envpython} -m piplicenses {posargs} --ignore-packages pip-requirements-parser pip_audit pip-api --allow-only="Apache Software License;ISC License (ISCL);MIT License;BSD License;Mozilla Public License 2.0 (MPL 2.0);Python Software Foundation License"

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

    tests,coverage,ghcoverage: {envpython} -Werror -m {env:MAYBE_COVERAGE:} virtue {posargs:jsonschema}
    tests: {envpython} -m doctest {toxinidir}/README.rst

    coverage: {envpython} -m coverage report --show-missing
    coverage: {envpython} -m coverage html --directory={envtmpdir}/htmlcov
    ghcoverage: sh {toxinidir}/.github/coverage.sh "{envpython}"

    perf-create: {envpython} {toxinidir}/jsonschema/benchmarks/validator_creation.py {posargs:--output {envtmpdir}/bench-create.json}
    perf-232: {envpython} {toxinidir}/jsonschema/benchmarks/issue232.py {posargs:--output {envtmpdir}/bench-issue232.json}
    perf-suite: {envpython} {toxinidir}/jsonschema/benchmarks/json_schema_test_suite.py --inherit-environ JSON_SCHEMA_TEST_SUITE {posargs:--output {envtmpdir}/bench-json_schema_test_suite.json}
deps =
    audit: pip-audit
    audit-formatnongpl: pip-licenses

    build: build

    perf: pyperf

    tests,coverage,ghcoverage: virtue

    coverage,ghcoverage: coverage>=7.0.0b1

[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:secrets]
deps = detect-secrets
commands = {envbindir}/detect-secrets scan {toxinidir}

[testenv:style]
deps = ruff
commands = {envpython} -m ruff check {toxinidir}

[testenv:typing]
skip_install = true
deps =
    # FIXME: Why are we repeating dependencies here?
    attrs
    mypy
    types-requests
commands = {envpython} -m mypy --config {toxinidir}/pyproject.toml {posargs} {toxinidir}/jsonschema

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

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

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

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

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