summaryrefslogtreecommitdiff
path: root/tox.ini
blob: 56bce5bee6afa6e0e253bb152a0c91027c364afe (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
[tox]
envlist = py

[testenv]
description =
  run tests with pytest (you can pass extra arguments for pytest,
  e.g., "tox -- --update-goldens")
deps =
    pytest >= 7.0
    pytest-cov
    pytest-randomly
    wcag-contrast-ratio
commands = pytest {posargs}
use_develop = True

[testenv:regexlint]
description =
  lint regular expressions with regexlint
deps =
    git+https://github.com/pygments/regexlint.git@master
commands = regexlint pygments.lexers


[testenv:pylint]
description =
  lint code with pylint
deps =
  pylint
skip_install = True # doesn't need installing Pygments into the venv
commands =
  pylint --rcfile scripts/pylintrc pygments


[testenv:check]
description =
  miscellaneous checks on the source code, including pyflakes
deps =
  flake8
commands =
  python scripts/check_crlf.py pygments external
  python scripts/detect_missing_analyse_text.py --skip-no-aliases
  # We only use pyflakes, not pycodestyle, but use it through flake8 nevertheless
  # to be able to use the --ignore option.
  flake8 --select F --ignore F401 pygments
  python scripts/check_sources.py -i pygments/lexers/_mapping.py \
        -i docs/_build -i pygments/formatters/_mapping.py -i pygments/unistring.py \
        -i tests/support/empty.py
  python scripts/count_token_references.py --minfiles=1 --maxfiles=1 \
                                           --minlines=1 --maxlines=3 --subtoken

[testenv:mapfiles]
description =
  regenerate map files
deps =
commands =
  python scripts/gen_mapfiles.py


[testenv:coverage]
description =
  run tests, and generate a coverage report in htmlcov/
commands =
  pytest --cov --cov-report=html --cov-report=term {posargs}


[testenv:doc]
description =
  compile documentation with Sphinx. You can pass a builder name,
  like "tox -e doc -- latex". You can also add extra options, like
  "SPHINXOPTS='-D latex_paper_size=letter' tox -e doc -- latex".
change_dir = doc
deps =
  sphinx
  wcag-contrast-ratio
commands =
  sphinx-build -b {posargs:html} -n {env:SPHINXOPTS} . _build/{posargs:html}


[testenv:web-doc]
description =
  same as doc, but also build the demo by compiling Pygments to WASM.
change_dir = doc
deps = {[testenv:doc]deps}
allowlist_externals =
  docker
setenv =
  # Enable the BuildKit backend to use the --output option.
  DOCKER_BUILDKIT = 1
  # Build the demo page.
  WEBSITE_BUILD = 1
commands =
  docker build --file pyodide/Dockerfile --output _build/pyodide/pyodide ..
  sphinx-build -b {posargs:html} {env:SPHINXOPTS} . _build/{posargs:html}