1 | # Tox (http://tox.testrun.org/) is a tool for running tests |
---|
2 | # in multiple virtualenvs. This configuration file will run the |
---|
3 | # test suite on all supported python versions. To use it, "pip install tox" |
---|
4 | # and then run "tox" from this directory. |
---|
5 | |
---|
6 | # Map Python versions in GitHub Actions to tox environments to run, for use by |
---|
7 | # the tox-gh-actions package. |
---|
8 | [gh-actions] |
---|
9 | python = |
---|
10 | 2.7: py27-coverage,codechecks |
---|
11 | 3.6: py36-coverage |
---|
12 | 3.7: py37-coverage,typechecks,codechecks3 |
---|
13 | 3.8: py38-coverage |
---|
14 | 3.9: py39-coverage |
---|
15 | pypy-3.7: pypy3 |
---|
16 | |
---|
17 | [pytest] |
---|
18 | twisted = 1 |
---|
19 | |
---|
20 | [tox] |
---|
21 | envlist = typechecks,codechecks,codechecks3,py{27,36,37,38,39}-{coverage},pypy27,pypy3,integration,integration3 |
---|
22 | minversion = 2.4 |
---|
23 | |
---|
24 | [testenv] |
---|
25 | passenv = TAHOE_LAFS_* PIP_* SUBUNITREPORTER_* USERPROFILE HOMEDRIVE HOMEPATH |
---|
26 | # Get "certifi" to avoid bug #2913. Basically if a `setup_requires=...` causes |
---|
27 | # a package to be installed (with setuptools) then it'll fail on certain |
---|
28 | # platforms (travis's OX-X 10.12, Slackware 14.2) because PyPI's TLS |
---|
29 | # requirements (TLS >= 1.2) are incompatible with the old TLS clients |
---|
30 | # available to those systems. Installing it ahead of time (with pip) avoids |
---|
31 | # this problem. |
---|
32 | deps = |
---|
33 | # Pin all of these versions for the same reason you ever want to pin |
---|
34 | # anything: to prevent new releases with regressions from introducing |
---|
35 | # spurious failures into CI runs for whatever development work is |
---|
36 | # happening at the time. The versions selected here are just the current |
---|
37 | # versions at the time. Bumping them to keep up with future releases is |
---|
38 | # fine as long as those releases are known to actually work. |
---|
39 | # |
---|
40 | # For now these are versions that support Python 2. |
---|
41 | pip==20.3.4 |
---|
42 | setuptools==44.1.1 |
---|
43 | wheel==0.36.2 |
---|
44 | subunitreporter==19.3.2 |
---|
45 | # As an exception, we don't pin certifi because it contains CA |
---|
46 | # certificates which necessarily change over time. Pinning this is |
---|
47 | # guaranteed to cause things to break eventually as old certificates |
---|
48 | # expire and as new ones are used in the wild that aren't present in |
---|
49 | # whatever version we pin. Hopefully there won't be functionality |
---|
50 | # regressions in new releases of this package that cause us the kind of |
---|
51 | # suffering we're trying to avoid with the above pins. |
---|
52 | certifi |
---|
53 | # VCS hooks support |
---|
54 | py36,!coverage: pre-commit |
---|
55 | |
---|
56 | # We add usedevelop=False because testing against a true installation gives |
---|
57 | # more useful results. |
---|
58 | usedevelop = False |
---|
59 | # We use extras=test to get things like "mock" that are required for our unit |
---|
60 | # tests. |
---|
61 | extras = test |
---|
62 | |
---|
63 | setenv = |
---|
64 | # Define TEST_SUITE in the environment as an aid to constructing the |
---|
65 | # correct test command below. |
---|
66 | TEST_SUITE = allmydata |
---|
67 | |
---|
68 | commands = |
---|
69 | # As an aid to debugging, dump all of the Python packages and their |
---|
70 | # versions that are installed in the test environment. This is |
---|
71 | # particularly useful to get from CI runs - though hopefully the |
---|
72 | # version pinning we do limits the variability of this output |
---|
73 | pip freeze |
---|
74 | |
---|
75 | tahoe --version |
---|
76 | |
---|
77 | python -c "import sys; print('sys.stdout.encoding:', sys.stdout.encoding)" |
---|
78 | |
---|
79 | # Run tests with -b to catch bugs like `"%s" % (some_bytes,)`. -b makes |
---|
80 | # Python emit BytesWarnings, and warnings configuration in |
---|
81 | # src/allmydata/tests/__init__.py turns allmydata's BytesWarnings into |
---|
82 | # exceptions. |
---|
83 | !coverage: python -b -m twisted.trial {env:TAHOE_LAFS_TRIAL_ARGS:--rterrors} {posargs:{env:TEST_SUITE}} |
---|
84 | |
---|
85 | # measuring coverage is somewhat slower than not measuring coverage |
---|
86 | # so only do it on request. |
---|
87 | coverage: python -b -m coverage run -m twisted.trial {env:TAHOE_LAFS_TRIAL_ARGS:--rterrors --reporter=timing} {posargs:{env:TEST_SUITE}} |
---|
88 | coverage: coverage combine |
---|
89 | coverage: coverage xml |
---|
90 | coverage: coverage report |
---|
91 | |
---|
92 | [testenv:integration] |
---|
93 | setenv = |
---|
94 | COVERAGE_PROCESS_START=.coveragerc |
---|
95 | commands = |
---|
96 | # NOTE: 'run with "py.test --keep-tempdir -s -v integration/" to debug failures' |
---|
97 | py.test --timeout=1800 --coverage -v {posargs:integration} |
---|
98 | coverage combine |
---|
99 | coverage report |
---|
100 | |
---|
101 | |
---|
102 | [testenv:integration3] |
---|
103 | basepython = python3 |
---|
104 | setenv = |
---|
105 | COVERAGE_PROCESS_START=.coveragerc |
---|
106 | commands = |
---|
107 | python --version |
---|
108 | # NOTE: 'run with "py.test --keep-tempdir -s -v integration/" to debug failures' |
---|
109 | py.test --timeout=1800 --coverage -v {posargs:integration} |
---|
110 | coverage combine |
---|
111 | coverage report |
---|
112 | |
---|
113 | |
---|
114 | # Once 2.7 is dropped, this can be removed. It just does flake8 with Python 2 |
---|
115 | # since that can give different results than flake8 on Python 3. |
---|
116 | [testenv:codechecks] |
---|
117 | basepython = python2.7 |
---|
118 | setenv = |
---|
119 | # If no positional arguments are given, try to run the checks on the |
---|
120 | # entire codebase, including various pieces of supporting code. |
---|
121 | DEFAULT_FILES=src integration static misc setup.py |
---|
122 | commands = |
---|
123 | flake8 {posargs:{env:DEFAULT_FILES}} |
---|
124 | |
---|
125 | |
---|
126 | [testenv:codechecks3] |
---|
127 | basepython = python3 |
---|
128 | deps = |
---|
129 | # Newer versions of PyLint have buggy configuration |
---|
130 | # (https://github.com/PyCQA/pylint/issues/4574), so stick to old version |
---|
131 | # for now. |
---|
132 | pylint < 2.5 |
---|
133 | # On macOS, git inside of towncrier needs $HOME. |
---|
134 | passenv = HOME |
---|
135 | setenv = |
---|
136 | # If no positional arguments are given, try to run the checks on the |
---|
137 | # entire codebase, including various pieces of supporting code. |
---|
138 | DEFAULT_FILES=src integration static misc setup.py |
---|
139 | commands = |
---|
140 | flake8 {posargs:{env:DEFAULT_FILES}} |
---|
141 | python misc/coding_tools/check-umids.py {posargs:{env:DEFAULT_FILES}} |
---|
142 | python misc/coding_tools/check-debugging.py {posargs:{env:DEFAULT_FILES}} |
---|
143 | python misc/coding_tools/find-trailing-spaces.py -r {posargs:{env:DEFAULT_FILES}} |
---|
144 | # PyLint has other useful checks, might want to enable them: |
---|
145 | # http://pylint.pycqa.org/en/latest/technical_reference/features.html |
---|
146 | pylint --disable=all --enable=cell-var-from-loop {posargs:{env:DEFAULT_FILES}} |
---|
147 | |
---|
148 | # If towncrier.check fails, you forgot to add a towncrier news |
---|
149 | # fragment explaining the change in this branch. Create one at |
---|
150 | # `newsfragments/<ticket>.<change type>` with some text for the news |
---|
151 | # file. See towncrier.toml for legal <change type> values. |
---|
152 | python -m towncrier.check --config towncrier.toml |
---|
153 | |
---|
154 | |
---|
155 | [testenv:typechecks] |
---|
156 | basepython = python3 |
---|
157 | skip_install = True |
---|
158 | deps = |
---|
159 | mypy |
---|
160 | mypy-zope |
---|
161 | types-mock |
---|
162 | types-six |
---|
163 | types-PyYAML |
---|
164 | types-pkg_resources |
---|
165 | git+https://github.com/warner/foolscap |
---|
166 | # Twisted 21.2.0 introduces some type hints which we are not yet |
---|
167 | # compatible with. |
---|
168 | # https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3622 |
---|
169 | twisted<21.2.0 |
---|
170 | commands = mypy src |
---|
171 | |
---|
172 | |
---|
173 | [testenv:draftnews] |
---|
174 | passenv = TAHOE_LAFS_* PIP_* SUBUNITREPORTER_* USERPROFILE HOMEDRIVE HOMEPATH |
---|
175 | deps = |
---|
176 | # see comment in [testenv] about "certifi" |
---|
177 | certifi |
---|
178 | towncrier==21.3.0 |
---|
179 | commands = |
---|
180 | python -m towncrier --draft --config towncrier.toml |
---|
181 | |
---|
182 | [testenv:news] |
---|
183 | # On macOS, git invoked from Tox needs $HOME. |
---|
184 | passenv = TAHOE_LAFS_* PIP_* SUBUNITREPORTER_* USERPROFILE HOMEDRIVE HOMEPATH HOME |
---|
185 | whitelist_externals = |
---|
186 | git |
---|
187 | deps = |
---|
188 | # see comment in [testenv] about "certifi" |
---|
189 | certifi |
---|
190 | towncrier==21.3.0 |
---|
191 | commands = |
---|
192 | python -m towncrier --yes --config towncrier.toml |
---|
193 | # commit the changes |
---|
194 | git commit -m "update NEWS.txt for release" |
---|
195 | |
---|
196 | [testenv:deprecations] |
---|
197 | commands = |
---|
198 | python misc/build_helpers/run-deprecations.py --package allmydata --warnings={env:TAHOE_LAFS_WARNINGS_LOG:_trial_temp/deprecation-warnings.log} trial {env:TAHOE_LAFS_TRIAL_ARGS:--rterrors} {posargs:allmydata} |
---|
199 | |
---|
200 | [testenv:upcoming-deprecations] |
---|
201 | deps = |
---|
202 | # Take the base deps as well! |
---|
203 | {[testenv]deps} |
---|
204 | git+https://github.com/warner/foolscap |
---|
205 | commands = |
---|
206 | flogtool --version |
---|
207 | python misc/build_helpers/run-deprecations.py --package allmydata --warnings={env:TAHOE_LAFS_WARNINGS_LOG:_trial_temp/deprecation-warnings.log} trial {env:TAHOE_LAFS_TRIAL_ARGS:--rterrors} {posargs:allmydata} |
---|
208 | |
---|
209 | # Use 'tox -e docs' to check formatting and cross-references in docs .rst |
---|
210 | # files. The published docs are built by code run over at readthedocs.org, |
---|
211 | # which does not use this target (but does something similar). |
---|
212 | # |
---|
213 | # If you have "sphinx" installed in your virtualenv, you can just do "make -C |
---|
214 | # docs html", or "cd docs; make html". |
---|
215 | # |
---|
216 | # You can also open docs/_build/html/index.html to see the rendered docs in |
---|
217 | # your web browser. |
---|
218 | |
---|
219 | [testenv:docs] |
---|
220 | # we pin docutils because of https://sourceforge.net/p/docutils/bugs/301/ |
---|
221 | # which asserts when it reads links to .svg files (e.g. about.rst) |
---|
222 | deps = |
---|
223 | sphinx |
---|
224 | docutils==0.12 |
---|
225 | recommonmark |
---|
226 | sphinx_rtd_theme |
---|
227 | # normal install is not needed for docs, and slows things down |
---|
228 | skip_install = True |
---|
229 | commands = |
---|
230 | sphinx-build -W -b html -d {toxinidir}/docs/_build/doctrees {toxinidir}/docs {toxinidir}/docs/_build/html |
---|
231 | |
---|
232 | [testenv:pyinstaller] |
---|
233 | # We override this to pass --no-use-pep517 because pyinstaller (3.4, at least) |
---|
234 | # is broken when this feature is enabled. |
---|
235 | install_command = python -m pip install --no-use-pep517 {opts} {packages} |
---|
236 | extras = |
---|
237 | deps = |
---|
238 | {[testenv]deps} |
---|
239 | packaging |
---|
240 | # PyInstaller 4.0 drops Python 2 support. When we finish porting to |
---|
241 | # Python 3 we can reconsider this constraint. |
---|
242 | pyinstaller < 4.0 |
---|
243 | pefile ; platform_system == "Windows" |
---|
244 | # Setting PYTHONHASHSEED to a known value assists with reproducible builds. |
---|
245 | # See https://pyinstaller.readthedocs.io/en/stable/advanced-topics.html#creating-a-reproducible-build |
---|
246 | setenv=PYTHONHASHSEED=1 |
---|
247 | commands= |
---|
248 | pip freeze |
---|
249 | pyinstaller -y --clean pyinstaller.spec |
---|
250 | |
---|
251 | [testenv:tarballs] |
---|
252 | basepython = python3 |
---|
253 | deps = |
---|
254 | commands = |
---|
255 | python setup.py update_version |
---|
256 | python setup.py sdist --formats=gztar bdist_wheel --universal |
---|