source: trunk/tox.ini

Last change on this file was 03a6546, checked in by Jean-Paul Calderone <exarkun@…>, at 2020-10-27T13:29:24Z

flake8 integration

  • Property mode set to 100644
File size: 9.7 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 = codechecks,py27,py36,pypy27
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     # VCS hooks support
41     py36,!coverage: pre-commit
42
43# We add usedevelop=False because testing against a true installation gives
44# more useful results.
45usedevelop = False
46# We use extras=test to get things like "mock" that are required for our unit
47# tests.
48extras = test
49
50setenv =
51       # Define TEST_SUITE in the environment as an aid to constructing the
52       # correct test command below.
53       !py36: TEST_SUITE = allmydata
54       py36: TEST_SUITE = allmydata.test.python3_tests
55
56commands =
57         # As an aid to debugging, dump all of the Python packages and their
58         # versions that are installed in the test environment.  This is
59         # particularly useful to get from CI runs - though hopefully the
60         # version pinning we do limits the variability of this output
61         pip freeze
62
63         tahoe --version
64
65         !coverage: trial {env:TAHOE_LAFS_TRIAL_ARGS:--rterrors} {posargs:{env:TEST_SUITE}}
66
67         # measuring coverage is somewhat slower than not measuring coverage
68         # so only do it on request.
69         coverage: coverage run -m twisted.trial {env:TAHOE_LAFS_TRIAL_ARGS:--rterrors --reporter=timing} {posargs:{env:TEST_SUITE}}
70         coverage: coverage combine
71         coverage: coverage xml
72         coverage: coverage report
73
74
75[testenv:integration]
76setenv =
77         COVERAGE_PROCESS_START=.coveragerc
78commands =
79         # NOTE: 'run with "py.test --keep-tempdir -s -v integration/" to debug failures'
80         py.test --coverage -v {posargs:integration}
81         coverage combine
82         coverage report
83
84
85[testenv:codechecks]
86basepython = python2.7
87# On macOS, git inside of towncrier needs $HOME.
88passenv = HOME
89whitelist_externals =
90         /bin/mv
91setenv =
92         # Workaround an error when towncrier is run under the VCS hook,
93         # https://stackoverflow.com/a/4027726/624787:
94         #   File "/home/rpatterson/src/work/sfu/tahoe-lafs/.tox/codechecks/lib/python2.7/site-packages/towncrier/check.py", line 44, in __main
95         #     .decode(getattr(sys.stdout, "encoding", "utf8"))
96         # `TypeError: decode() argument 1 must be string, not None`
97         PYTHONIOENCODING=utf_8
98commands =
99         flake8 src integration static misc setup.py
100         python misc/coding_tools/check-umids.py src
101         python misc/coding_tools/check-debugging.py
102         python misc/coding_tools/find-trailing-spaces.py -r src static misc setup.py
103         python misc/coding_tools/check-miscaptures.py
104
105         # If towncrier.check fails, you forgot to add a towncrier news
106         # fragment explaining the change in this branch.  Create one at
107         # `newsfragments/<ticket>.<change type>` with some text for the news
108         # file.  See pyproject.toml for legal <change type> values.
109         python -m towncrier.check --pyproject towncrier.pyproject.toml
110
111[testenv:draftnews]
112passenv = TAHOE_LAFS_* PIP_* SUBUNITREPORTER_* USERPROFILE HOMEDRIVE HOMEPATH
113# see comment in [testenv] about "certifi"
114whitelist_externals = mv
115deps =
116     certifi
117     towncrier >= 19.2
118commands =
119         # With pip >= 10 the existence of pyproject.toml (which we are
120         # required to have to configure towncrier) triggers a "build
121         # isolation" mode which prevents anything from working.  Avoid
122         # triggering that pip behavior by keeping the towncrier configuration
123         # somewhere else and only bringing it in when it's actually needed
124         # (after pip is done).
125         #
126         # Some discussion is available at
127         # https://github.com/pypa/pip/issues/5696
128         #
129         # towncrier post 19.2 (unreleased as of this writing) adds a --config
130         # option that can be used instead of this file shuffling.
131         mv towncrier.pyproject.toml pyproject.toml
132
133         # towncrier 19.2 + works with python2.7
134         python -m towncrier --draft
135
136         # put it back
137         mv pyproject.toml towncrier.pyproject.toml
138
139[testenv:news]
140passenv = TAHOE_LAFS_* PIP_* SUBUNITREPORTER_* USERPROFILE HOMEDRIVE HOMEPATH
141# see comment in [testenv] about "certifi"
142whitelist_externals = mv
143deps =
144     certifi
145     towncrier >= 19.2
146commands =
147         # With pip >= 10 the existence of pyproject.toml (which we are
148         # required to have to configure towncrier) triggers a "build
149         # isolation" mode which prevents anything from working.  Avoid
150         # triggering that pip behavior by keeping the towncrier configuration
151         # somewhere else and only bringing it in when it's actually needed
152         # (after pip is done).
153         #
154         # Some discussion is available at
155         # https://github.com/pypa/pip/issues/5696
156         #
157         # towncrier post 19.2 (unreleased as of this writing) adds a --config
158         # option that can be used instead of this file shuffling.
159         mv towncrier.pyproject.toml pyproject.toml
160
161         # towncrier 19.2 + works with python2.7
162         python -m towncrier --yes
163
164         # put it back
165         mv pyproject.toml towncrier.pyproject.toml
166
167         # commit the changes
168         git commit -m "update NEWS.txt for release"
169
170[testenv:deprecations]
171setenv =
172         PYTHONWARNINGS=default::DeprecationWarning
173commands =
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:upcoming-deprecations]
177setenv =
178         PYTHONWARNINGS=default::DeprecationWarning
179deps =
180     # Take the base deps as well!
181     {[testenv]deps}
182     git+https://github.com/warner/foolscap
183commands =
184         flogtool --version
185         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}
186
187[testenv:checkmemory]
188commands =
189         rm -rf _test_memory
190         python src/allmydata/test/check_memory.py upload
191         python src/allmydata/test/check_memory.py upload-self
192         python src/allmydata/test/check_memory.py upload-POST
193         python src/allmydata/test/check_memory.py download
194         python src/allmydata/test/check_memory.py download-GET
195         python src/allmydata/test/check_memory.py download-GET-slow
196         python src/allmydata/test/check_memory.py receive
197
198# Use 'tox -e docs' to check formatting and cross-references in docs .rst
199# files. The published docs are built by code run over at readthedocs.org,
200# which does not use this target (but does something similar).
201#
202# If you have "sphinx" installed in your virtualenv, you can just do "make -C
203# docs html", or "cd docs; make html".
204#
205# You can also open docs/_build/html/index.html to see the rendered docs in
206# your web browser.
207
208[testenv:docs]
209# we pin docutils because of https://sourceforge.net/p/docutils/bugs/301/
210# which asserts when it reads links to .svg files (e.g. about.rst)
211deps =
212     sphinx
213     docutils==0.12
214# normal install is not needed for docs, and slows things down
215skip_install = True
216commands =
217         sphinx-build -b html -d {toxinidir}/docs/_build/doctrees {toxinidir}/docs {toxinidir}/docs/_build/html
218
219[testenv:pyinstaller]
220# We override this to pass --no-use-pep517 because pyinstaller (3.4, at least)
221# is broken when this feature is enabled.
222install_command = python -m pip install --no-use-pep517 {opts} {packages}
223extras =
224deps =
225    {[testenv]deps}
226    packaging
227    # PyInstaller 4.0 drops Python 2 support.  When we finish porting to
228    # Python 3 we can reconsider this constraint.
229    pyinstaller < 4.0
230# Setting PYTHONHASHSEED to a known value assists with reproducible builds.
231# See https://pyinstaller.readthedocs.io/en/stable/advanced-topics.html#creating-a-reproducible-build
232setenv=PYTHONHASHSEED=1
233commands=
234    pip freeze
235    pyinstaller -y --clean pyinstaller.spec
236
237[testenv:tarballs]
238deps =
239commands =
240         python setup.py update_version
241         python setup.py sdist --formats=bztar,gztar,zip bdist_wheel
Note: See TracBrowser for help on using the repository browser.