{{ message }}
Repository navigation
Expand file tree
/
Copy pathtox.ini
More file actions
238 lines (214 loc) · 9.32 KB
/
Copy pathtox.ini
File metadata and controls
238 lines (214 loc) · 9.32 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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
[tox]
envlist =
py{312,313,313t,314,314t,dev}-test{,-recdeps,-docdeps,-alldeps,-oldestdeps,-devdeps,-devpytest,-predeps,-mpl380}{,-cov}{,-clocale}{,-fitsio}{,-noscipy}
# Only these two exact tox environments have corresponding figure hash files.
py312-test-image-mpl380-cov
py312-test-image-mpldev-cov
build_docs{,-predeps}
linkcheck
codestyle
stubtest
requires =
tox >=4.33 # for PEP 508 environment markers # keep in sync with pyproject.toml
tox-uv >= 1.35 # for cache proper invalidation on UV_* env vars changes
[testenv]
# Pass through the following environment variables which are needed for the CI
passenv = HOME,WINDIR,LC_ALL,LC_CTYPE,CC,CI,IS_CRON,ARCH_ON_CI,PY_COLORS,PYTHON_GIL
setenv =
NUMPY_WARN_IF_NO_MEM_POLICY = 1
COVERAGE_CORE = sysmon # note that this is the default setting on Python 3.14+, and is incompatible with branch coverage on 3.12 and 3.13 PYTHON_LT_3_14
cov: COVERAGE_FILE = {toxinidir}/.coverage
# For coverage, we need to pass extra options to the C compiler
cov: CFLAGS = --coverage -fno-inline-functions -O0
py313t: PYTHON_GIL=0
image: MPLFLAGS = -m "mpl_image_compare" --mpl --mpl-generate-summary=html --mpl-results-path="{toxinidir}/results" --mpl-hash-library="{toxinidir}/astropy/tests/figures/{envname}.json" --mpl-baseline-path=https://raw.githubusercontent.com/astropy/astropy-figure-tests/astropy-main/figures/{envname}/ --remote-data
!image: MPLFLAGS =
clocale: LC_CTYPE = C.ascii
clocale: LC_ALL = C
fitsio: ASTROPY_ALWAYS_TEST_FITSIO = true
# on oldestdeps, we let warnings be warnings (-Wdefault) instead of treated-as-errors,
# so we don't need to deal with filtering anything triggered from dependencies
# Other options replicate the static configuration from pyproject.toml, since they
# would otherwise be shadowed by the env variable.
oldestdeps: PYTEST_ADDOPTS = -Wdefault --doctest-rst --strict-config --strict-markers
# for predeps, disable global configuration from pyproject.toml
# In particular this implies:
# * disable uv.index: nightlies are excluded and won't take
# precedence over pre-releases distributed on PyPI
# * disable uv.exclude-newer: short-lived pre-releases are still included in resolution
# * disable uv.no-build-package: allow source installs for every package
predeps: UV_NO_CONFIG = 1
# Run the tests in a temporary directory to make sure that we don't import
# astropy from the source tree
changedir = .tmp/{envname}
# tox environments are constructed with so-called 'factors' (or terms)
# separated by hyphens, e.g. test-devdeps-cov. Lines below starting with factor:
# will only take effect if that factor is included in the environment name. To
# see a list of example environments that can be run, along with a description,
# run:
#
# tox -l -v
#
description =
run tests
recdeps: with recommended optional dependencies
docdeps: with documentation dependencies
alldeps: with all optional and test dependencies
devdeps: with the latest developer version of key dependencies
devpytest: with dev version of pytest infrastructure
oldestdeps: with the oldest supported version of direct dependencies
cov: and test coverage
image: with image tests
mpl380: with matplotlib 3.8.4
mpldev: with the latest developer version of matplotlib
double: twice in a row to check for global state changes
noscipy: without scipy-dev
deps =
# matplotlib 3.8 + pyparsing 3.3 = DeprecationWarning
mpl380: matplotlib==3.8.4
mpl380: pyparsing==3.2.5
# Some FITS tests use fitsio as a comparison
fitsio: fitsio
# Include scipy in double run to detect test pollution in scipy-only tests
double: scipy
# The devdeps factor is intended to be used to install the latest developer version
# or nightly wheel of key dependencies.
devdeps-!noscipy: scipy>=0.0.dev0
devdeps: numpy>=0.0.dev0
devdeps-!noscipy: matplotlib>=0.0.dev0
devdeps: pyerfa>=0.0.dev0
mpldev: matplotlib>=0.0.dev0
# Latest developer version of infrastructure packages.
devpytest: scipy
devpytest: git+https://github.com/pytest-dev/pytest.git
devpytest: git+https://github.com/astropy/extension-helpers.git
devpytest: git+https://github.com/scientific-python/pytest-doctestplus.git
devpytest: git+https://github.com/astropy/pytest-remotedata.git
devpytest: git+https://github.com/astropy/pytest-astropy-header.git
devpytest: git+https://github.com/astropy/pytest-arraydiff.git
devpytest: git+https://github.com/astropy/pytest-filter-subpackage.git
devpytest: git+https://github.com/matplotlib/pytest-mpl.git
# Duplicates test_all in pyproject.toml due to upstream bug
# https://github.com/tox-dev/tox/issues/3433
# But we cannot use alldeps because it messed up oldest-deps pins.
devdeps-!noscipy: objgraph>=1.6.0
devdeps-!noscipy: skyfield>=1.20
devdeps-!noscipy: sgp4>=2.3
devdeps-!noscipy: array-api-strict>=1.0
devdeps-!noscipy: numpy-quaddtype>=0.2.2
# The following indicates which [project.optional-dependencies] from pyproject.toml will be installed.
# test_all does not work here due to upstream bug https://github.com/tox-dev/tox/issues/3433
extras =
test: test
recdeps: recommended
alldeps, docdeps: all
docdeps: docs
dependency_groups =
alldeps: dataframe
image: image-tests
commands =
# docdeps-predeps: Override sphinx max pin in sphinx-design
docdeps-predeps: uv pip install sphinx -U --pre --no-deps
{list_dependencies_command}
!cov-!double: pytest --strict-markers --pyargs astropy "{toxinidir}/docs" {env:MPLFLAGS} {posargs}
cov-!double: pytest --strict-markers --pyargs astropy "{toxinidir}/docs" {env:MPLFLAGS} --cov astropy --cov-config="{toxinidir}/pyproject.toml" --cov-report xml:"{toxinidir}/coverage.xml" {posargs}
double: pytest --keep-duplicates --strict-markers --pyargs astropy "{toxinidir}/docs" astropy "{toxinidir}/docs" {env:MPLFLAGS} {posargs}
pip_pre =
devdeps: true
predeps: true
uv_resolution =
# The oldestdeps factor is intended to be used to install
# the oldest versions of all dependencies.
# Let uv handle this for us by requesting all requirements should be
# resolved to their oldest compatible versions (including transitive dependencies)
oldestdeps: lowest
# This lets developers use tox to build docs and ignores warnings.
# This is not used in CI; For that, we have RTD PR builder.
[testenv:build_docs{,-predeps}]
changedir = docs
description = invoke sphinx-build to build the HTML docs
extras =
docs
all
dependency_groups =
dataframe
commands =
# predeps: Override sphinx max pin in sphinx-design;
# we need to reinstall sphinxcontrib-globalsubs, too as it either sphinx<9 or >=9
predeps: uv pip install sphinx sphinxcontrib-globalsubs -U --pre
{list_dependencies_command}
sphinx-build \
predeps: -W \
-b html . _build/html {posargs:-j auto}
pip_pre =
predeps: true
[testenv:linkcheck]
changedir = docs
description = check the links in the HTML docs
extras = docs
commands =
{list_dependencies_command}
sphinx-build -b linkcheck . _build/html {posargs:-W}
[testenv:codestyle]
skip_install = true
description = Run all style and file checks with pre-commit
deps =
pre-commit
commands =
pre-commit install-hooks
pre-commit run {posargs:--color always --all-files --show-diff-on-failure}
[testenv:stubtest]
description = test automatically generated stubs for unit definition modules
allowlist_externals =
touch
deps =
mypy
commands =
# We do not want to distribute py.typed files, but we need one or else Mypy
# refuses to look at the generated stubs.
touch {env_site_packages_dir}/astropy/units/py.typed
stubtest --mypy-config-file pyproject.toml \
astropy.units.astrophys \
astropy.units.cds \
astropy.units.cgs \
astropy.units.imperial \
astropy.units.misc \
astropy.units.photometric \
astropy.units.required_by_vounit \
astropy.units.si \
astropy.units.function.units
[testenv:mypy]
description = check type annotations in files declared to be type-checkable
allowlist_externals =
touch
deps =
mypy
extras =
test
commands =
# We do not want to distribute py.typed files, but we need one or else Mypy
# refuses to type check anything (in tox).
touch {env_site_packages_dir}/astropy/py.typed
mypy
[testenv:pyinstaller]
# Check that astropy can be included in a PyInstaller bundle without any issues. This
# also serves as a test that tests do not import anything from outside the tests
# directories with relative imports, since we copy the tests out to a separate directory
# to run them.
description = check that astropy can be included in a pyinstaller bundle
changedir = .pyinstaller
extras = test
dependency_groups =
pyinstaller
commands =
pyinstaller --onefile run_astropy_tests.py \
--distpath . \
--additional-hooks-dir hooks \
--exclude-module tkinter \
--collect-submodules=py \
--hidden-import pytest \
--hidden-import pytest_doctestplus.plugin \
--hidden-import pytest_remotedata.plugin \
--hidden-import pytest_skip_slow \
--hidden-import pytest_mpl.plugin
./run_astropy_tests --astropy-root "{toxinidir}"
You can’t perform that action at this time.
