source: trunk/tox.ini

Last change on this file was a3f5a0d, checked in by Jason R. Coombs <jaraco@…>, at 2020-08-30T16:06:56Z

Merge branch 'master' into 3394.py38-tests

  • Property mode set to 100644
File size: 9.1 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[pytest]
7twisted = 1
8
9[tox]
10envlist = {py27,pypy27,py36}{-coverage,}
11minversion = 2.4
12
13[testenv]
14passenv = TAHOE_LAFS_* PIP_* SUBUNITREPORTER_* USERPROFILE HOMEDRIVE HOMEPATH
15# Get "certifi" to avoid bug #2913. Basically if a `setup_requires=...` causes
16# a package to be installed (with setuptools) then it'll fail on certain
17# platforms (travis's OX-X 10.12, Slackware 14.2) because PyPI's TLS
18# requirements (TLS >= 1.2) are incompatible with the old TLS clients
19# available to those systems.  Installing it ahead of time (with pip) avoids
20# this problem.
21deps =
22     # Pin all of these versions for the same reason you ever want to pin
23     # anything: to prevent new releases with regressions from introducing
24     # spurious failures into CI runs for whatever development work is
25     # happening at the time.  The versions selected here are just the current
26     # versions at the time.  Bumping them to keep up with future releases is
27     # fine as long as those releases are known to actually work.
28     pip==19.1.1
29     setuptools==41.0.1
30     wheel==0.33.4
31     subunitreporter==19.3.2
32     # As an exception, we don't pin certifi because it contains CA
33     # certificates which necessarily change over time.  Pinning this is
34     # guaranteed to cause things to break eventually as old certificates
35     # expire and as new ones are used in the wild that aren't present in
36     # whatever version we pin.  Hopefully there won't be functionality
37     # regressions in new releases of this package that cause us the kind of
38     # suffering we're trying to avoid with the above pins.
39     certifi
40
41# We add usedevelop=False because testing against a true installation gives
42# more useful results.
43usedevelop = False
44# We use extras=test to get things like "mock" that are required for our unit
45# tests.
46extras = test
47
48setenv =
49       # Define TEST_SUITE in the environment as an aid to constructing the
50       # correct test command below.
51       !py36: TEST_SUITE = allmydata
52       py36: TEST_SUITE = allmydata.test.python3_tests
53
54commands =
55         # As an aid to debugging, dump all of the Python packages and their
56         # versions that are installed in the test environment.  This is
57         # particularly useful to get from CI runs - though hopefully the
58         # version pinning we do limits the variability of this output
59         pip freeze
60
61         tahoe --version
62
63         !coverage: trial {env:TAHOE_LAFS_TRIAL_ARGS:--rterrors} {posargs:{env:TEST_SUITE}}
64
65         # measuring coverage is somewhat slower than not measuring coverage
66         # so only do it on request.
67         coverage: coverage run -m twisted.trial {env:TAHOE_LAFS_TRIAL_ARGS:--rterrors --reporter=timing} {posargs:{env:TEST_SUITE}}
68         coverage: coverage combine
69         coverage: coverage xml
70
71
72[testenv:integration]
73setenv =
74         COVERAGE_PROCESS_START=.coveragerc
75commands =
76         # NOTE: 'run with "py.test --keep-tempdir -s -v integration/" to debug failures'
77         py.test --coverage -v {posargs:integration}
78         coverage combine
79         coverage report
80
81
82[testenv:codechecks]
83# On macOS, git inside of towncrier needs $HOME.
84passenv = HOME
85whitelist_externals =
86         /bin/mv
87commands =
88         flake8 src static misc setup.py
89         python misc/coding_tools/check-umids.py src
90         python misc/coding_tools/check-debugging.py
91         python misc/coding_tools/find-trailing-spaces.py -r src static misc setup.py
92         python misc/coding_tools/check-miscaptures.py
93
94         # If towncrier.check fails, you forgot to add a towncrier news
95         # fragment explaining the change in this branch.  Create one at
96         # `newsfragments/<ticket>.<change type>` with some text for the news
97         # file.  See pyproject.toml for legal <change type> values.
98         python -m towncrier.check --pyproject towncrier.pyproject.toml
99
100[testenv:draftnews]
101passenv = TAHOE_LAFS_* PIP_* SUBUNITREPORTER_* USERPROFILE HOMEDRIVE HOMEPATH
102# see comment in [testenv] about "certifi"
103whitelist_externals = mv
104deps =
105     certifi
106     towncrier >= 19.2
107commands =
108         # With pip >= 10 the existence of pyproject.toml (which we are
109         # required to have to configure towncrier) triggers a "build
110         # isolation" mode which prevents anything from working.  Avoid
111         # triggering that pip behavior by keeping the towncrier configuration
112         # somewhere else and only bringing it in when it's actually needed
113         # (after pip is done).
114         #
115         # Some discussion is available at
116         # https://github.com/pypa/pip/issues/5696
117         #
118         # towncrier post 19.2 (unreleased as of this writing) adds a --config
119         # option that can be used instead of this file shuffling.
120         mv towncrier.pyproject.toml pyproject.toml
121
122         # towncrier 19.2 + works with python2.7
123         python -m towncrier --draft
124
125         # put it back
126         mv pyproject.toml towncrier.pyproject.toml
127
128[testenv:news]
129passenv = TAHOE_LAFS_* PIP_* SUBUNITREPORTER_* USERPROFILE HOMEDRIVE HOMEPATH
130# see comment in [testenv] about "certifi"
131whitelist_externals = mv
132deps =
133     certifi
134     towncrier >= 19.2
135commands =
136         # With pip >= 10 the existence of pyproject.toml (which we are
137         # required to have to configure towncrier) triggers a "build
138         # isolation" mode which prevents anything from working.  Avoid
139         # triggering that pip behavior by keeping the towncrier configuration
140         # somewhere else and only bringing it in when it's actually needed
141         # (after pip is done).
142         #
143         # Some discussion is available at
144         # https://github.com/pypa/pip/issues/5696
145         #
146         # towncrier post 19.2 (unreleased as of this writing) adds a --config
147         # option that can be used instead of this file shuffling.
148         mv towncrier.pyproject.toml pyproject.toml
149
150         # towncrier 19.2 + works with python2.7
151         python -m towncrier --yes
152
153         # put it back
154         mv pyproject.toml towncrier.pyproject.toml
155
156         # commit the changes
157         git commit -m "update NEWS.txt for release"
158
159[testenv:deprecations]
160setenv =
161         PYTHONWARNINGS=default::DeprecationWarning
162commands =
163         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}
164
165[testenv:upcoming-deprecations]
166setenv =
167         PYTHONWARNINGS=default::DeprecationWarning
168deps =
169     # Take the base deps as well!
170     {[testenv]deps}
171     git+https://github.com/warner/foolscap
172commands =
173         flogtool --version
174         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}
175
176[testenv:checkmemory]
177commands =
178         rm -rf _test_memory
179         python src/allmydata/test/check_memory.py upload
180         python src/allmydata/test/check_memory.py upload-self
181         python src/allmydata/test/check_memory.py upload-POST
182         python src/allmydata/test/check_memory.py download
183         python src/allmydata/test/check_memory.py download-GET
184         python src/allmydata/test/check_memory.py download-GET-slow
185         python src/allmydata/test/check_memory.py receive
186
187# Use 'tox -e docs' to check formatting and cross-references in docs .rst
188# files. The published docs are built by code run over at readthedocs.org,
189# which does not use this target (but does something similar).
190#
191# If you have "sphinx" installed in your virtualenv, you can just do "make -C
192# docs html", or "cd docs; make html".
193#
194# You can also open docs/_build/html/index.html to see the rendered docs in
195# your web browser.
196
197[testenv:docs]
198# we pin docutils because of https://sourceforge.net/p/docutils/bugs/301/
199# which asserts when it reads links to .svg files (e.g. about.rst)
200deps =
201     sphinx
202     docutils==0.12
203# normal install is not needed for docs, and slows things down
204skip_install = True
205commands =
206         sphinx-build -b html -d {toxinidir}/docs/_build/doctrees {toxinidir}/docs {toxinidir}/docs/_build/html
207
208[testenv:pyinstaller]
209# We override this to pass --no-use-pep517 because pyinstaller (3.4, at least)
210# is broken when this feature is enabled.
211install_command = python -m pip install --no-use-pep517 {opts} {packages}
212extras =
213deps =
214    {[testenv]deps}
215    packaging
216    # PyInstaller 4.0 drops Python 2 support.  When we finish porting to
217    # Python 3 we can reconsider this constraint.
218    pyinstaller < 4.0
219# Setting PYTHONHASHSEED to a known value assists with reproducible builds.
220# See https://pyinstaller.readthedocs.io/en/stable/advanced-topics.html#creating-a-reproducible-build
221setenv=PYTHONHASHSEED=1
222commands=
223    pip freeze
224    pyinstaller -y --clean pyinstaller.spec
225
226[testenv:tarballs]
227deps =
228commands =
229         python setup.py update_version
230         python setup.py sdist --formats=bztar,gztar,zip bdist_wheel
Note: See TracBrowser for help on using the repository browser.