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 | 3.8: py38-coverage |
---|
11 | 3.9: py39-coverage |
---|
12 | 3.10: py310-coverage |
---|
13 | 3.11: py311-coverage |
---|
14 | 3.12: py312-coverage |
---|
15 | pypy-3.8: pypy38 |
---|
16 | pypy-3.9: pypy39 |
---|
17 | |
---|
18 | [pytest] |
---|
19 | twisted = 1 |
---|
20 | |
---|
21 | [tox] |
---|
22 | envlist = typechecks,codechecks,py{38,39,310,311,312}-{coverage},pypy27,pypy38,pypy39,integration |
---|
23 | minversion = 4 |
---|
24 | |
---|
25 | [testenv] |
---|
26 | # Install code the real way, for maximum realism. |
---|
27 | usedevelop = False |
---|
28 | |
---|
29 | passenv = TAHOE_LAFS_*,PIP_*,SUBUNITREPORTER_*,USERPROFILE,HOMEDRIVE,HOMEPATH,COLUMNS |
---|
30 | deps = |
---|
31 | # We pull in certify *here* to avoid bug #2913. Basically if a |
---|
32 | # `setup_requires=...` causes a package to be installed (with setuptools) |
---|
33 | # then it'll fail on certain platforms (travis's OX-X 10.12, Slackware |
---|
34 | # 14.2) because PyPI's TLS requirements (TLS >= 1.2) are incompatible with |
---|
35 | # the old TLS clients available to those systems. Installing it ahead of |
---|
36 | # time (with pip) avoids this problem. |
---|
37 | # |
---|
38 | # We don't pin an exact version of it because it contains CA certificates |
---|
39 | # which necessarily change over time. Pinning this is guaranteed to cause |
---|
40 | # things to break eventually as old certificates expire and as new ones |
---|
41 | # are used in the wild that aren't present in whatever version we pin. |
---|
42 | # Hopefully there won't be functionality regressions in new releases of |
---|
43 | # this package that cause us the kind of suffering we're trying to avoid |
---|
44 | # with the above pins. |
---|
45 | certifi |
---|
46 | |
---|
47 | extras = |
---|
48 | # Get general testing environment dependencies so we can run the tests |
---|
49 | # how we like. |
---|
50 | testenv |
---|
51 | |
---|
52 | # And get all of the test suite's actual direct Python dependencies. |
---|
53 | test |
---|
54 | |
---|
55 | setenv = |
---|
56 | # Define TEST_SUITE in the environment as an aid to constructing the |
---|
57 | # correct test command below. |
---|
58 | TEST_SUITE = allmydata |
---|
59 | COLUMNS = 80 |
---|
60 | |
---|
61 | commands = |
---|
62 | # As an aid to debugging, dump all of the Python packages and their |
---|
63 | # versions that are installed in the test environment. This is |
---|
64 | # particularly useful to get from CI runs - though hopefully the |
---|
65 | # version pinning we do limits the variability of this output |
---|
66 | pip freeze |
---|
67 | |
---|
68 | tahoe --version |
---|
69 | |
---|
70 | python -c "import sys; print('sys.stdout.encoding:', sys.stdout.encoding)" |
---|
71 | |
---|
72 | # Run tests with -b to catch bugs like `"%s" % (some_bytes,)`. -b makes |
---|
73 | # Python emit BytesWarnings, and warnings configuration in |
---|
74 | # src/allmydata/tests/__init__.py turns allmydata's BytesWarnings into |
---|
75 | # exceptions. |
---|
76 | !coverage: python -b -m twisted.trial {env:TAHOE_LAFS_TRIAL_ARGS:--rterrors} {posargs:{env:TEST_SUITE}} |
---|
77 | |
---|
78 | # measuring coverage is somewhat slower than not measuring coverage |
---|
79 | # so only do it on request. |
---|
80 | coverage: python -b -m coverage run -m twisted.trial {env:TAHOE_LAFS_TRIAL_ARGS:--rterrors --reporter=timing} {posargs:{env:TEST_SUITE}} |
---|
81 | coverage: coverage combine |
---|
82 | coverage: coverage xml |
---|
83 | |
---|
84 | [testenv:integration] |
---|
85 | usedevelop = False |
---|
86 | basepython = python3 |
---|
87 | platform = mylinux: linux |
---|
88 | mymacos: darwin |
---|
89 | mywindows: win32 |
---|
90 | setenv = |
---|
91 | COVERAGE_PROCESS_START=.coveragerc |
---|
92 | commands = |
---|
93 | # NOTE: 'run with "py.test --keep-tempdir -s -v integration/" to debug failures' |
---|
94 | py.test --timeout=1800 --coverage -s -v {posargs:integration} |
---|
95 | coverage combine |
---|
96 | |
---|
97 | |
---|
98 | [testenv:codechecks] |
---|
99 | basepython = python3 |
---|
100 | skip_install = true |
---|
101 | deps = |
---|
102 | # Pin a specific version so we get consistent outcomes; update this |
---|
103 | # occasionally: |
---|
104 | ruff == 0.1.6 |
---|
105 | towncrier |
---|
106 | # On macOS, git inside of towncrier needs $HOME. |
---|
107 | passenv = HOME |
---|
108 | setenv = |
---|
109 | # If no positional arguments are given, try to run the checks on the |
---|
110 | # entire codebase, including various pieces of supporting code. |
---|
111 | DEFAULT_FILES=src integration benchmarks static misc setup.py |
---|
112 | commands = |
---|
113 | ruff check {posargs:{env:DEFAULT_FILES}} |
---|
114 | python misc/coding_tools/check-umids.py {posargs:{env:DEFAULT_FILES}} |
---|
115 | python misc/coding_tools/check-debugging.py {posargs:{env:DEFAULT_FILES}} |
---|
116 | |
---|
117 | # If towncrier.check fails, you forgot to add a towncrier news |
---|
118 | # fragment explaining the change in this branch. Create one at |
---|
119 | # `newsfragments/<ticket>.<change type>` with some text for the news |
---|
120 | # file. See towncrier.toml for legal <change type> values. |
---|
121 | python -m towncrier.check --config towncrier.toml |
---|
122 | |
---|
123 | |
---|
124 | [testenv:typechecks] |
---|
125 | basepython = python3 |
---|
126 | deps = |
---|
127 | mypy==1.8.0 |
---|
128 | mypy-zope |
---|
129 | types-mock |
---|
130 | types-six |
---|
131 | types-PyYAML |
---|
132 | types-setuptools |
---|
133 | types-pyOpenSSL |
---|
134 | foolscap |
---|
135 | # Upgrade when new releases come out: |
---|
136 | Twisted==23.10.0 |
---|
137 | commands = |
---|
138 | # Different versions of Python have a different standard library, and we |
---|
139 | # want to be compatible with all the variations. For speed's sake we only do |
---|
140 | # the earliest and latest versions. |
---|
141 | mypy --python-version=3.8 src |
---|
142 | mypy --python-version=3.12 src |
---|
143 | |
---|
144 | |
---|
145 | [testenv:draftnews] |
---|
146 | passenv = TAHOE_LAFS_*,PIP_*,SUBUNITREPORTER_*,USERPROFILE,HOMEDRIVE,HOMEPATH,COLUMNS |
---|
147 | deps = |
---|
148 | # see comment in [testenv] about "certifi" |
---|
149 | certifi |
---|
150 | towncrier==23.11.0 |
---|
151 | commands = |
---|
152 | python -m towncrier --draft --config towncrier.toml |
---|
153 | |
---|
154 | [testenv:news] |
---|
155 | # On macOS, git invoked from Tox needs $HOME. |
---|
156 | passenv = TAHOE_LAFS_*,PIP_*,SUBUNITREPORTER_*,USERPROFILE,HOMEDRIVE,HOMEPATH,COLUMNS |
---|
157 | whitelist_externals = |
---|
158 | git |
---|
159 | deps = |
---|
160 | # see comment in [testenv] about "certifi" |
---|
161 | certifi |
---|
162 | towncrier==23.11.0 |
---|
163 | commands = |
---|
164 | python -m towncrier --yes --config towncrier.toml |
---|
165 | # commit the changes |
---|
166 | git commit -m "update NEWS.txt for release" |
---|
167 | |
---|
168 | [testenv:deprecations] |
---|
169 | commands = |
---|
170 | 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} |
---|
171 | |
---|
172 | [testenv:upcoming-deprecations] |
---|
173 | deps = |
---|
174 | # Take the base deps as well! |
---|
175 | {[testenv]deps} |
---|
176 | git+https://github.com/warner/foolscap |
---|
177 | commands = |
---|
178 | flogtool --version |
---|
179 | 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} |
---|
180 | |
---|
181 | # Use 'tox -e docs' to check formatting and cross-references in docs .rst |
---|
182 | # files. The published docs are built by code run over at readthedocs.org, |
---|
183 | # which does not use this target (but does something similar). |
---|
184 | # |
---|
185 | # If you have "sphinx" installed in your virtualenv, you can just do "make -C |
---|
186 | # docs html", or "cd docs; make html". |
---|
187 | # |
---|
188 | # You can also open docs/_build/html/index.html to see the rendered docs in |
---|
189 | # your web browser. |
---|
190 | |
---|
191 | [testenv:docs] |
---|
192 | deps = |
---|
193 | -r docs/requirements.txt |
---|
194 | # normal install is not needed for docs, and slows things down |
---|
195 | skip_install = True |
---|
196 | commands = |
---|
197 | sphinx-build -W -b html -d {toxinidir}/docs/_build/doctrees {toxinidir}/docs {toxinidir}/docs/_build/html |
---|
198 | |
---|
199 | [testenv:pyinstaller] |
---|
200 | extras = |
---|
201 | deps = |
---|
202 | {[testenv]deps} |
---|
203 | packaging |
---|
204 | pyinstaller |
---|
205 | pefile ; platform_system == "Windows" |
---|
206 | # Setting PYTHONHASHSEED to a known value assists with reproducible builds. |
---|
207 | # See https://pyinstaller.readthedocs.io/en/stable/advanced-topics.html#creating-a-reproducible-build |
---|
208 | setenv=PYTHONHASHSEED=1 |
---|
209 | commands= |
---|
210 | pip freeze |
---|
211 | pyinstaller -y --clean pyinstaller.spec |
---|
212 | |
---|
213 | [testenv:tarballs] |
---|
214 | basepython = python3 |
---|
215 | deps = |
---|
216 | commands = |
---|
217 | python setup.py update_version |
---|
218 | python setup.py sdist --formats=gztar bdist_wheel --universal |
---|