Repository navigation
Expand file tree
/
Copy pathtox.ini
More file actions
107 lines (101 loc) · 4.39 KB
/
Copy pathtox.ini
File metadata and controls
107 lines (101 loc) · 4.39 KB
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
[tox]
min_version = 4.0
envlist =
py314
build_docs{,-devdeps}
sunpy_docs{,-devdeps}
website{,-devdeps}
a11y{,-firefox}
visual{,-firefox}
# convenience label to build the docs and run the a11y/visual tests, e.g.
# tox run -m a11y
labels =
a11y = build_docs, a11y
visual = build_docs, visual
[testenv]
allowlist_externals=
/bin/sh
/usr/bin/git
/usr/bin/make
pass_env =
# A variable to tell tests we are on a CI system
CI
# Custom compiler locations (such as ccache)
CC
# Location of locales (needed by sphinx on some systems)
LOCALE_ARCHIVE
# If the user has set a LC override we should follow it
LC_ALL
set_env =
MPLBACKEND = agg
SUNPY_SAMPLEDIR = {env:SUNPY_SAMPLEDIR:{toxinidir}/.tox/{envname}/sample_data/}
HIDE_PARFIVE_PROGRESS = True
# Pin to a stable absolute path so the nix-shell-set value (read-only nix
# store) flows into the tox env; falls back to {tox_root}/.ms-playwright for
# CI/dev where commands installs the browsers.
PLAYWRIGHT_BROWSERS_PATH = {env:PLAYWRIGHT_BROWSERS_PATH:{tox_root}/.ms-playwright}
# Browser + maxfail for the Playwright envs, selected by the firefox factor
firefox: BROWSER = firefox
!firefox: BROWSER = chromium
firefox: MAXFAIL = 5
!firefox: MAXFAIL = 1
deps =
devdeps: git+https://github.com/pydata/pydata-sphinx-theme.git
description = "run the theme unit tests"
extras =
test
commands =
pip freeze --all --no-input
pytest {posargs}
[testenv:build_docs{,-devdeps}]
changedir = docs
description = Invoke sphinx-build to build the HTML docs
extras =
docs
commands =
pip freeze --all --no-input
sphinx-build -j auto --color -W --keep-going -b html -d _build/.doctrees . _build/html -a {posargs}
python -c 'import pathlib; print("Package Docs available under file://\{0\}".format(pathlib.Path(r"{toxinidir}").absolute() / "docs" / "_build" / "html" / "index.html"))'
# Playwright-driven tests against the built docs site.
# The docs must be built first (tox run -e build_docs,a11y or tox run -m a11y).
[testenv:{a11y,visual}{,-firefox}]
description = run a11y/visual tests with Playwright
depends =
build_docs
extras =
test
test-playwright
allowlist_externals =
playwright
npm
bash
commands =
bash -c 'test -d docs/_build/html/ && echo "--- Docs build exists ---" || exit -1'
a11y: npm install
{env:PLAYWRIGHT_INSTALL_CMD:bash -c 'if [[ "{env:CI:}" == "true" ]]; then playwright install --with-deps {env:BROWSER}; else playwright install {env:BROWSER}; fi'}
a11y: pytest -m "a11y" --maxfail={env:MAXFAIL} --browser={env:BROWSER} {posargs:--tracing=retain-on-failure}
visual: pytest -m "mpl_image_compare" --mpl --mpl-generate-summary=html --mpl-baseline-path=https://raw.githubusercontent.com/sunpy/sunpy-figure-tests/sunpy-sphinx-theme-main/figures/{envname}/ --browser={env:BROWSER} {posargs}
[testenv:sunpy_docs{,-devdeps}]
changedir = .tmp/{envname}
commands =
/bin/sh -c "git -C sunpy pull || git clone https://github.com/sunpy/sunpy"
python -m pip install -v -e "sunpy/.[all,docs]"
pip freeze --all --no-input
sphinx-build --color -b html sunpy/docs sunpy/docs/_build/html -D plot_gallery=0 -a {posargs}
python -c 'import pathlib; print("Suny Docs available under file://\{0\}".format(pathlib.Path("./sunpy/docs").absolute() / "_build" / "html" / "index.html"))'
[testenv:website{,-devdeps}]
changedir = .tmp/{envname}
commands =
/bin/sh -c "git -C sunpy.org pull || git clone --recurse-submodules https://github.com/sunpy/sunpy.org"
python -m pip install -r "sunpy.org/requirements.txt"
pip freeze --all --no-input
sphinx-build --color -b dirhtml sunpy.org/ sunpy.org/_build/html -a {posargs}
python -c 'import pathlib; print("Website available under file://\{0\}".format(pathlib.Path("./sunpy.org").absolute() / "_build" / "html" / "index.html"))'
[testenv:astropy_website{,-devdeps}]
changedir = .tmp/{envname}
commands =
/bin/sh -c "git -C astropy.org pull || git clone --recurse-submodules https://github.com/astropy/astropy.github.com astropy.org"
python -m pip install -r "astropy.org/requirements.txt"
pip freeze --all --no-input
sphinx-build --color -b dirhtml astropy.org/ astropy.org/_build/html -a {posargs}
python -c 'import pathlib; print("Astropy website available under file://\{0\}".format(pathlib.Path("./astropy.org").absolute() / "_build" / "html" / "index.html"))'