-
Notifications
You must be signed in to change notification settings - Fork 50
/
tox.ini
239 lines (201 loc) · 7.87 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
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
239
;
; Coverage is always reported at the end of test run.
;
[tox]
minversion=3.20.1
requires=
virtualenv>=20.0.35
envlist =
test,pyflakes,mypy,testdocs
[testenv]
allowlist_externals =
git
rm
sh
touch
mkdir
passenv = *
[testenv:test]
description = Run tests and coverage report
extras =
test
commands =
coverage erase
coverage run -m pytest -vv {posargs: pydoctor}
coverage report -m
# The XML version is generatred to be uploaded to Codecov.
coverage xml -o coverage.xml -i
[testenv:test-latest-twisted]
description = Run tests with latest Twisted version
deps =
git+https://github.com/twisted/twisted.git
extras =
test
commands =
pytest -vv {posargs: pydoctor}
[testenv:twisted-apidoc]
deps =
pytest
commands =
; Run current version against twisted trunk
rm -rf {toxworkdir}/twisted-trunk
git clone --depth 1 --branch trunk https://github.com/twisted/twisted.git {toxworkdir}/twisted-trunk
- pydoctor --config {toxworkdir}/twisted-trunk/setup.cfg \
--html-output {toxworkdir}/twisted-apidocs-build \
--project-base-dir {toxworkdir}/twisted-trunk/ \
{toxworkdir}/twisted-trunk/src/twisted/ --theme=classic
pytest -vv docs/tests/test_twisted_docs.py
[testenv:pyflakes]
description = Run pyflakes over the pydoctor code
deps =
pyflakes
commands =
; Custom pyflakes run to exlcude some files. The demo packages are trigerring some unused imports warnings. But pydoctor uses those imports to resolve links. So we skip pyflakes for the demo sites. But not the test files.
sh -c "find pydoctor/ -name \*.py ! -path '*/testpackages/*' ! -path '*/sre_parse36.py' ! -path '*/sre_constants36.py' | xargs pyflakes"
sh -c "find docs/ -name \*.py ! -path '*demo/*' | xargs pyflakes"
[testenv:cpython-apidocs]
description = Build CPython 3.11 API documentation
deps =
pytest
commands =
sh -c "if [ ! -d {toxworkdir}/cpython ]; then \
git clone https://github.com/python/cpython.git {toxworkdir}/cpython; \
fi"
sh -c "cd {toxworkdir}/cpython && git checkout 3.11"
touch {toxworkdir}/cpython/Lib/__init__.py
rm -rf {toxworkdir}/cpython-output
mkdir {toxworkdir}/cpython-output
sh -c "pydoctor \
--docformat=restructuredtext \
--project-base-dir={toxworkdir}/cpython \
--html-output={toxworkdir}/cpython-output \
; the sidebar is making the build time two times longer for the cpython docs,
; so we just skip it.
--no-sidebar \
{toxworkdir}/cpython/Lib | tee {toxworkdir}/cpython-output/run.log"
pytest -vv docs/tests/test_standard_library_docs.py
[testenv:numpy-apidocs]
description = Build numpy API documentation. For now we don't check for any warnings or other errors. The only purpose of this test is to make sure pydoctor doesn't crash.
deps =
pytest
commands =
sh -c "if [ ! -d {toxworkdir}/numpy ]; then \
git clone --depth 1 https://github.com/numpy/numpy.git {toxworkdir}/numpy; \
fi"
sh -c "cd {toxworkdir}/numpy && git pull"
rm -rf {toxworkdir}/numpy-output
python3 -c "from pydoctor.driver import main; \
code = main(['--html-summary-pages', '--quiet', \
'--html-output={toxworkdir}/numpy-output', \
'{toxworkdir}/numpy/numpy']); \
# Code 2 error means bad docstrings, which is OK for this test.
assert code==2, 'pydoctor exited with code %s, expected code 2.'%code"
# Requires cmake
[testenv:python-igraph-apidocs]
description = Build python-igraph API documentation
deps =
pytest
commands =
sh -c "if [ ! -d {toxworkdir}/python-igraph ]; then \
git clone --recurse-submodules https://github.com/igraph/python-igraph.git {toxworkdir}/python-igraph; \
fi"
sh -c "cd {toxworkdir}/python-igraph && git pull"
rm -rf {toxworkdir}/python-igraph-output
sh -c "cd {toxworkdir}/python-igraph/ && python3 ./setup.py bdist_wheel && python3 -m pip install dist/*.whl"
sh -c "pydoctor \
--project-url 'https://igraph.org/python' \
--docformat=epytext \
--html-output={toxworkdir}/python-igraph-output \
--introspect-c-modules --quiet \
$(python3 -c 'import igraph, os; print(os.path.dirname(igraph.__file__))') || true"
pytest -vv docs/tests/test_python_igraph_docs.py
[testenv:pytype-apidocs]
description = Build pytype API documentation
; The only purpose of this test is to make sure pydoctor doesn't crash.
commands =
sh -c "if [ ! -d {toxworkdir}/pytype ]; then \
git clone https://github.com/google/pytype.git {toxworkdir}/pytype; \
fi"
sh -c "cd {toxworkdir}/pytype && git pull"
rm -rf {toxworkdir}/pytype-output
sh -c "pydoctor \
--docformat=plaintext \
--html-output={toxworkdir}/pytype-output \
--quiet {toxworkdir}/pytype/pytype"
[testenv:git-buildpackage-apidocs]
description = Build git-buildpackage API documentation
; The only purpose of this test is to make sure pydoctor doesn't crash.
commands =
sh -c "if [ ! -d {toxworkdir}/git-buildpackage ]; then \
git clone https://salsa.debian.org/agx/git-buildpackage.git {toxworkdir}/git-buildpackage; \
fi"
sh -c "cd {toxworkdir}/git-buildpackage && git pull"
rm -rf {toxworkdir}git-buildpackage-output
python3 -c "from pydoctor.driver import main; \
code = main(['--quiet', \
'--html-output={toxworkdir}/git-buildpackage-output', \
'{toxworkdir}/git-buildpackage/gbp', '{toxworkdir}/git-buildpackage/tests']); \
# Code 2 error means bad docstrings, which is OK for this test.
assert code in [0,2], 'pydoctor exited with code %s, expected code 0 or 2.'%code"
[testenv:cpython-summary]
description = Parse CPython 3.11 code and write a summary only
commands =
sh -c "if [ ! -d {toxworkdir}/cpython ]; then \
git clone https://github.com/python/cpython.git {toxworkdir}/cpython; \
fi"
sh -c "cd {toxworkdir}/cpython && git checkout 3.11"
touch {toxworkdir}/cpython/Lib/__init__.py
rm -rf {toxworkdir}/cpython-summary-output
pydoctor \
--docformat=plaintext \
--project-base-dir={toxworkdir}/cpython \
--html-output={toxworkdir}/cpython-summary-output \
--html-summary-pages \
{toxworkdir}/cpython/Lib
[testenv:mypy]
description = run mypy (static type checker)
extras =
mypy
commands =
mypy \
--cache-dir="{toxworkdir}/mypy_cache" \
--exclude='pydoctor/test/testpackages' \
{tty:--pretty:} \
{posargs:pydoctor docs/epytext_demo}
[testenv:apidocs]
description = Build only the API documentation
commands =
pydoctor \
--project-name=pydoctor \
--project-url=https://github.com/twisted/pydoctor/ \
--html-viewsource-base=https://github.com/twisted/pydoctor/tree/master \
--html-output=build/apidocs \
--project-base-dir="{toxinidir}" \
--docformat=epytext \
--privacy="HIDDEN:pydoctor.test" \
--make-html --warnings-as-errors \
{posargs:pydoctor}
[testenv:docs]
description = Build the full documentation
extras = docs
commands =
sphinx-build -aE -b html {toxinidir}/docs/source {toxinidir}/build/docs
sphinx-build -aE -b spelling {toxinidir}/docs/source {toxinidir}/build/docs
[testenv:testdocs]
description = Build and test the full documentation
extras = docs
deps = pytest
setenv =
TOX_INI_DIR = {toxinidir}
allowlist_externals = echo
commands =
echo "::group::Sphinx build"
sphinx-build -aE -b html -W {toxinidir}/docs/source {toxinidir}/build/docs
echo "::endgroup::"
echo "::group::Main inventory dump"
python -m sphinx.ext.intersphinx {toxinidir}/build/docs/api/objects.inv
echo "::endgroup::"
echo "::group::Epytext demo inventory dump"
python -m sphinx.ext.intersphinx {toxinidir}/build/docs/docformat/epytext_demo/objects.inv
echo "::endgroup::"
pytest -vv docs/tests/test.py