summaryrefslogtreecommitdiff
path: root/tox.ini
diff options
context:
space:
mode:
authorJean Abou-Samra <jean@abou-samra.fr>2023-02-23 13:44:22 +0100
committerGitHub <noreply@github.com>2023-02-23 13:44:22 +0100
commite589fee754a76e9600dcb42baaeb3372d9e163d7 (patch)
tree34a4a1bef36b0d1b65b8925e9751a9ee3bdc7281 /tox.ini
parent1e85f7c2ad2edfeae7f0c566163931324f64f949 (diff)
downloadpygments-git-e589fee754a76e9600dcb42baaeb3372d9e163d7.tar.gz
Replace Makefile with tox (#2331)
Porting notes: - tox handles Python environments automatically. Remove a bit of PYTHONPATH manipulation (that was using Python 2 code which always failed!) - No `clean` target: `git clean -xdf` should fit the bill. - No `reindent` target: the `reindent.py` script it was using does not exist (anymore?). - No equivalent of tox-test-coverage, which was an artifact of the past, using nose. Instead, the test-coverage target only is ported, which uses pytest, and works.
Diffstat (limited to 'tox.ini')
-rw-r--r--tox.ini86
1 files changed, 82 insertions, 4 deletions
diff --git a/tox.ini b/tox.ini
index 0de97559..1dcc73a7 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,15 +1,93 @@
[tox]
-envlist = py{37, 38, 39, 310, 311, 312}, lint
+envlist = py
[testenv]
+description =
+ run tests with pytest (you can pass extra arguments for pytest,
+ e.g., "tox -- --update-goldens")
deps =
- pytest
+ pytest >= 7.0
pytest-cov
+ pytest-randomly
wcag-contrast-ratio
commands = pytest {posargs}
+use_develop = True
-
-[testenv:lint]
+[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} {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}