source: trunk/tox.ini

Last change on this file was 27fb817, checked in by meejah <meejah@…>, at 2024-12-14T09:13:08Z

tox changed their minds again

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