7
7
python-subunit
8
8
junitxml
9
9
coverage
10
- coverage-enable-subprocess
10
+
11
+ # this is pinned since it's a bit of an obscure package.
12
+ coverage-enable-subprocess ==1.0
11
13
12
14
# cyptography 2.2 requires setuptools >= 18.5
13
15
#
@@ -23,29 +25,37 @@ deps =
23
25
# install the "enum34" dependency of cryptography.
24
26
pip>=10
25
27
26
- setenv =
27
- PYTHONDONTWRITEBYTECODE = no_byte_code
28
- COVERAGE_PROCESS_START = {toxinidir}/.coveragerc
29
-
30
28
[testenv]
31
29
deps =
32
30
{[base]deps}
33
31
extras = all, test
34
32
35
- whitelist_externals =
36
- sh
37
-
38
33
setenv =
39
- {[base]setenv}
34
+ # use a postgres db for tox environments with "-postgres" in the name
35
+ # (see https://tox.readthedocs.io/en/3.20.1/config.html#factors-and-factor-conditional-settings)
40
36
postgres: SYNAPSE_POSTGRES = 1
37
+
38
+ # this is used by .coveragerc to refer to the top of our tree.
41
39
TOP ={toxinidir}
42
40
43
41
passenv = *
44
42
45
43
commands =
46
- /usr/bin/find " {toxinidir}" -name ' *.pyc' -delete
47
- # Add this so that coverage will run on subprocesses
48
- {envbindir}/coverage run " {envbindir}/trial" {env:TRIAL_FLAGS:} {posargs:tests} {env:TOXSUFFIX:}
44
+ # the "env" invocation enables coverage checking for sub-processes. This is
45
+ # particularly important when running trial with `-j`, since that will make
46
+ # it run tests in a subprocess, whose coverage would otherwise not be
47
+ # tracked. (It also makes an explicit `coverage run` command redundant.)
48
+ #
49
+ # (See https://coverage.readthedocs.io/en/coverage-5.3/subprocess.html.
50
+ # Note that the `coverage.process_startup()` call is done by
51
+ # `coverage-enable-subprocess`.)
52
+ #
53
+ # we use "env" rather than putting a value in `setenv` so that it is not
54
+ # inherited by other tox environments.
55
+ #
56
+ # keep this in sync with the copy in `testenv:py35-old`.
57
+ #
58
+ /usr/bin/env COVERAGE_PROCESS_START ={toxinidir}/.coveragerc " {envbindir}/trial" {env:TRIAL_FLAGS:} {posargs:tests} {env:TOXSUFFIX:}
49
59
50
60
# As of twisted 16.4, trial tries to import the tests as a package (previously
51
61
# it loaded the files explicitly), which means they need to be on the
@@ -80,10 +90,9 @@ deps =
80
90
81
91
lxml
82
92
coverage
83
- coverage-enable-subprocess
93
+ coverage-enable-subprocess ==1.0
84
94
85
95
commands =
86
- /usr/bin/find " {toxinidir}" -name ' *.pyc' -delete
87
96
# Make all greater-thans equals so we test the oldest version of our direct
88
97
# dependencies, but make the pyopenssl 17.0, which can work against an
89
98
# OpenSSL 1.1 compiled cryptography (as older ones don't compile on Travis).
@@ -92,7 +101,11 @@ commands =
92
101
# Install Synapse itself. This won't update any libraries.
93
102
pip install -e " .[test]"
94
103
95
- {envbindir}/coverage run " {envbindir}/trial" {env:TRIAL_FLAGS:} {posargs:tests} {env:TOXSUFFIX:}
104
+ # we have to duplicate the command from `testenv` rather than refer to it
105
+ # as `{[testenv]commands}`, because we run on ubuntu xenial, which has
106
+ # tox 2.3.1, and https://github.com/tox-dev/tox/issues/208.
107
+ #
108
+ /usr/bin/env COVERAGE_PROCESS_START ={toxinidir}/.coveragerc " {envbindir}/trial" {env:TRIAL_FLAGS:} {posargs:tests} {env:TOXSUFFIX:}
96
109
97
110
[testenv:benchmark]
98
111
deps =
@@ -157,7 +170,3 @@ deps =
157
170
{[base]deps}
158
171
extras = all,mypy
159
172
commands = mypy
160
-
161
- # To find all folders that pass mypy you run:
162
- #
163
- # find synapse/* -type d -not -name __pycache__ -exec bash -c "mypy '{}' > /dev/null" \; -print
0 commit comments