/
tox.ini
160 lines (135 loc) · 4.36 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
[tox]
skip_missing_interpreters = true
envlist =
flake8
coverage
# CPython
py36-{tw189,tw1910,twtrunk,asyncio}
py37-{tw189,tw1910,twtrunk,asyncio}
py38-{tw189,tw1910,twtrunk,asyncio}
py39-{tw189,tw1910,twtrunk,asyncio}
# PyPy
pypy37-{tw189,tw1910,twtrunk,asyncio}
# MAP: GitHub Actions Python Name => Tox Env Name (for Python)
#
# when called without a specific environment ("-e"), detect the
# python version / get from GH action, and map to tox env
#
# https://github.com/ymyzk/tox-gh-actions
#
[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38
3.9: py39
pypy-3.6: pypy36
pypy-3.7: pypy37
[testenv]
deps =
coverage
pytest
; txaio
git+https://github.com/crossbario/txaio
; twisted dependencies
tw189: twisted==18.9.0
tw1910: twisted==19.10.0
# twtrunk: https://github.com/twisted/twisted/archive/trunk.zip
twtrunk: git+https://github.com/twisted/twisted
{tw189,tw1910,twtrunk}: pytest-twisted
; asyncio dependencies
asyncio: pytest_asyncio
extras =
encryption
serialization
scram
nvx
commands =
# download and extract archive with XBR ABI files into package directory for bundling
rm -f /tmp/xbr-protocol-latest.zip
curl -s https://xbr.network/lib/abi/xbr-protocol-latest.zip -o /tmp/xbr-protocol-latest.zip
unzip -t /tmp/xbr-protocol-latest.zip
rm -rf {toxinidir}/autobahn/xbr/contracts
unzip /tmp/xbr-protocol-latest.zip -d {toxinidir}/autobahn/xbr/contracts
# install package
sh -c "which python && which pip && python -V"
pip install --no-cache --ignore-installed --force-reinstall .[twisted,asyncio,compress,serialization,encryption,scram]
asyncio: {envbindir}/py.test -v {envsitepackagesdir}/autobahn
tw189,tw1910: {envbindir}/trial {envsitepackagesdir}/autobahn
twtrunk: python -m twisted.trial {envsitepackagesdir}/autobahn
whitelist_externals =
sh
coverage
codecov
cp
mkdir
rm
ls
mv
curl
unzip
setenv =
SODIUM_INSTALL = bundled
# env var for serializers
PYUBJSON_NO_EXTENSION = 1
#AUTOBAHN_USE_NVX = 1
#AUTOBAHN_USE_UJSON = 1
#AUTOBAHN_USE_CBOR2 = 1
asyncio: USE_ASYNCIO = 1
tw189,tw1910,twtrunk: USE_TWISTED = 1
# this enables "autobahn/test/test_rng.py" (on Linux),
# which tests entropy depletion, and tests how to correctly
# read _real_ entropy and block if not enough _real_ entropy is currently avail
# also: https://github.com/crossbario/autobahn-python/issues/1275
# AUTOBAHN_CI_ENABLE_RNG_DEPLETION_TESTS = 1
[testenv:flake8]
skip_install = True
deps =
flake8
pep8-naming
exclude = autobahn/wamp/gen
max-line-length = 119
commands =
sh -c "which python"
python -V
flake8 --version
; These ignores will be removed when they are fixed and we are flake8-clean
flake8 --ignore=E402,E501,E722,E741,N801,N802,N803,N805,N806,N815 \
--exclude "autobahn/wamp/message_fbs.py,autobahn/wamp/gen/*" \
autobahn
[testenv:coverage]
skip_install = False
deps =
coverage
codecov
pytest
pytest_asyncio
pytest-twisted
twisted
git+https://github.com/crossbario/txaio
extras =
encryption
serialization
scram
nvx
xbr
passenv =
CODECOV_TOKEN
commands =
# download and extract archive with XBR ABI files into package directory for bundling
rm -f /tmp/xbr-protocol-latest.zip
curl -s https://xbr.network/lib/abi/xbr-protocol-latest.zip -o /tmp/xbr-protocol-latest.zip
unzip -t /tmp/xbr-protocol-latest.zip
rm -rf {toxinidir}/autobahn/xbr/contracts
unzip /tmp/xbr-protocol-latest.zip -d {toxinidir}/autobahn/xbr/contracts
# install package with all optional extensions
pip install .[all]
# test autobahn on asyncio (run under coverage)
sh -c 'USE_ASYNCIO=1 coverage run --parallel-mode --include "*/autobahn/asyncio/*" --omit "*/twisted/*" --omit "*/test/*.py" {envbindir}/py.test -v {envsitepackagesdir}/autobahn'
# test autobahn on twisted (run under coverage)
sh -c 'USE_TWISTED=1 coverage run --parallel-mode --include "*/autobahn/*" --omit "*/asyncio/*" --omit "*/test/*.py" -m twisted.trial {envsitepackagesdir}/autobahn'
twtrunk,asyncio: sh -c "mkdir -p {homedir}/coverage && cp {toxinidir}/.coverage.* {homedir}/coverage/ && ls -la {homedir}/coverage"
coverage combine
coverage report
coverage html
codecov