-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
132 lines (124 loc) · 4.9 KB
/
tox.ini
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
120
121
122
123
124
125
126
127
128
129
130
131
132
[tox]
min_version = 4
# list of environments to run by default with tox run
# using Python 3.12 as the default, this needs to be kept in line with
# .github/actions/set-dev-env/action.yml (default Python version)
env_list =
lint,
compile,
py312-docs,
py312-tests,
a11y-tests
# convenience label for running tests with a given Python version, aimed at
# helping contributors run tests locally
# tox run -m tests
labels =
tests = compile, py312-tests
a11y = compile, py312-docs, a11y-tests
# general tox env configuration
# these can be run with any py3{9,12} version
# tox run -e py39-lint
[testenv]
deps =
lint: pre-commit
compile: sphinx-theme-builder[cli]
profile-docs: py-spy
extras =
{docs-no-checks, docs-linkcheck, profile-docs}: doc
skip_install =
lint: true # do not need to install to lint
profile-docs: true # avoids issues with py-spy and setting the git repo
compile: false
package = editable
commands =
lint: pre-commit run -a
compile: stb compile
# can substitute the target directory
docs-no-checks: sphinx-build {posargs:audit}/site {posargs:audit}/_build
docs-linkcheck: sphinx-build -W -b linkcheck docs/ docs/_build/html --keep-going
# example tox run -e py39-profile-docs -- -o profile.svg -n 100
; profile-docs: python ./tools/profile.py {posargs}
# tests can be ran with or without coverage (see examples below),
# it is recommended to run compile before running tests (see examples below),
# tox run -e compile,py39-tests
# if you want to skip the assets compilation step you can run the tests without
#`compile`, for example:
# tox run -e py39-tests
# run tests with a specific Sphinx version
# tox run -e compile,py39-sphinx61-tests
# run tests without coverage
# tox run -e compile,py39-tests-no-cov
[testenv:py3{9,10,11,12}{,-sphinx61,-sphinxdev,}-tests{,-no-cov}]
description = "Run tests Python and Sphinx versions. If a Sphinx version is specified, it will use that version vs the default in pyproject.toml"
# need to ensure the package is installed in editable mode
package = editable
extras =
test # install dependencies - defined in pyproject.toml
deps =
coverage[toml]
py39-sphinx61-tests: sphinx~=6.1.0
py312-sphinxdev: sphinx[test] @ git+https://github.com/sphinx-doc/sphinx.git@master
depends = compile
commands =
py3{9,10,11,12}{,-sphinx61,-sphinxdev,}-tests: coverage run -m pytest -m "not a11y" {posargs}
py3{9,10,11,12}{,-sphinx61,-sphinxdev,}-tests-no-cov: pytest -m "not a11y" {posargs}
# run accessibility tests with Playwright and axe-core
# compiling the assets is needed before running the tests
# tox run -e compile,py312-docs,a11y-tests
[testenv:a11y-tests]
description = run accessibility tests with Playwright and axe-core
base_python = py312 # keep in sync with tests.yml
pass_env = GITHUB_ACTIONS # so we can check if this is run on GitHub Actions
extras =
test
a11y
depends =
compile,
py312-docs
allowlist_externals=
playwright
bash
commands =
bash -c 'if [[ "{env:GITHUB_ACTIONS:}" == "true" ]]; then playwright install --with-deps; else playwright install; fi'
pytest -m "a11y" {posargs}
# build PST documentation with the default or a specific Sphinx version
# since we are building the documentation we install the packaged dev version of PST
# tox run -e py39-docs
# tox run -e py39-sphinx61-docs
[testenv:py3{9,12}{,-sphinx61}-docs]
description = build the documentation and place in docs/_build/html
# suppress Py3.11's new "can't debug frozen modules" warning
set_env = PYDEVD_DISABLE_FILE_VALIDATION=1
# keep this in sync across all docs environments
extras = {[testenv:docs-no-checks]extras}
deps =
py39-sphinx61-docs: sphinx~=6.1.0
commands =
sphinx-build -b html docs/ docs/_build/html -v -w warnings.txt {posargs}
python tests/utils/check_warnings.py
# recommended for local development, this command will build the PST documentation
# with the default Sphinx version and the PST installed in editable mode
# tox run -e docs-dev
[testenv:docs-dev]
description = build the documentation and place in docs/_build/html (dev mode)
# suppress Py3.11's new "can't debug frozen modules" warning
set_env = PYDEVD_DISABLE_FILE_VALIDATION=1
# keep this in sync across all docs environments
extras = {[testenv:docs-no-checks]extras}
package = editable
commands =
sphinx-build -b html docs/ docs/_build/html -v -w warnings.txt {posargs}
python tests/utils/check_warnings.py
[testenv:docs-live]
description = "Build and serve the documentation with live-reload"
extras =
dev
i18n
package = editable
deps =
sphinx-theme-builder[cli]@git+https://github.com/pradyunsg/sphinx-theme-builder#egg=d9f620b
# suppress Py3.11's new "can't debug frozen modules" warning
set_env = PYDEVD_DISABLE_FILE_VALIDATION=1
commands =
pybabel compile -d src/sphinx_syft_theme/locale -D sphinx
stb serve docs --open-browser --re-ignore=locale|api|_build #|\.jupyterlite\.doit\.db