summaryrefslogtreecommitdiff
path: root/tox.ini
blob: 8669ab30a9adb796f6bd2a08ef8da10c27e46cf1 (plain)
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
#===========================================================================
# Passlib configuration for TOX
#===========================================================================
#
# TODO: rewrite to use tox 1.8's "factors" feature
# TODO: figure out best way to pass extra args to all nosetest calls.
#       needed for jenkins to pass "--with-xunit --xunit-file=nosetests-{envname}.xml"
#
#-----------------------------------------------------------------------
# config options
#-----------------------------------------------------------------------
#
# PASSLIB_TEST_MODE:
#
#    The default test environment sets PASSLIB_TEST_MODE=full.
#    If you're wanting to quickly test various under various environments,
#    you may want to pick another value:
#
#    "quick"
#        run the bare minimum tests to ensure functionality.
#        variable-cost hashes are tested at their lowest setting.
#        hash algorithms are only tested against the backend that will
#        be used on the current host. no fuzz testing is done.
#
#    "default"
#        same as ``"quick"``, except: hash algorithms are tested
#        at default levels, and a brief round of fuzz testing is done
#        for each hash.
#
#    "full"
#        extra regression and internal tests are enabled, hash algorithms are tested
#        against all available backends, unavailable ones are mocked whre possible,
#        additional time is devoted to fuzz testing.
#
#-----------------------------------------------------------------------
# vm test environments
#-----------------------------------------------------------------------
# The default testenv assumes py3, with specific configurations for py26/27.
#
# Tox is configured by default to run all the test environments,
# with the exception of "jython27" and "gae25", which usually require special setup.
#
#-----------------------------------------------------------------------
# external library integration tests
#-----------------------------------------------------------------------
# There are a few optional libraries, whose integration is tested separately.
# Each has it's own section (below) which deals with it's particular requirements:
#
#   * M2Crypto
#   * BCrypt Backends
#   * Django
#
# NOTE: The 'bcrypt' package is tested through the normal VM tests,
#       and requires libffi-dev (unless e.g. there's a wheel available for your platform).
#===========================================================================

#===========================================================================
# global config
#===========================================================================
[tox]
minversion=1.8
envlist =
    py{26,27,32,33,34},
    pypy,pypy3,
    m2crypto-py{2,3},
    other-bcrypt-py{2,3},wo-bcrypt-py3,
    django{,14,145,15}-py2,
    django{,16,17,-wo-bcrypt}-py3,
    gae-py27

#===========================================================================
# stock CPython VMs
#
# NOTE: bcrypt requires libffi-dev
#
# NOTE: '_mindeps' section isn't used by tox -- it's a custom var with just
#       minimal dependancies required for testing (e.g. no bcrypt, m2crypto, etc),
#       used as shared config var by a bunch of other tests below.
#===========================================================================

# default (python 3) configuration
[testenv]
setenv =
    PASSLIB_TEST_MODE = full
changedir = {envdir}
commands =
    nosetests {posargs:--randomize passlib.tests}
_mindeps =
    nose
    coverage
    randomize
    unittest2py3k
deps =
    {[testenv]_mindeps}
    bcrypt

[testenv:py27]
_mindeps =
    # NOTE: this is custom var with just minimal dependancies required for test
    #       (e.g. no bcrypt, m2crypto, etc)
    nose
    coverage
    randomize
    unittest2
deps =
    {[testenv:py27]_mindeps}
    bcrypt

[testenv:py26]
deps = {[testenv:py27]deps}

#===========================================================================
# M2Crypto accel testing
#
# Passlib uses M2Crypto to accelerate certain PBKDF2 calls,
# Since those calls reasonably widespread, the M2Crypto test envs
# run the full suite of passlib tests.
#
# NOTE: M2Crypto requires python-dev, swig, & libssl-dev
#===========================================================================

# TODO: restrict these down to just the tests M2Crypto affects.

[testenv:m2crypto-py2]
basepython = python2
deps =
    {[testenv:py27]deps}
    M2Crypto

[testenv:m2crypto-py3]
basepython = python3
deps =
    {[testenv]deps}
    M2Crypto

#===========================================================================
# bcrypt backend testing
#
# bcrypt -- https://pypi.python.org/pypi/bcrypt
# py-bcrypt -- https://pypi.python.org/pypi/py-bcrypt/
# bcryptor - https://pypi.python.org/pypi/Bcryptor
#
# 'bcrypt' is the recommended bcrypt library for passlib,
# and is tested under the various VM-specific test envs (py27, py31, etc)
# the remainder are tested below.
#
# NOTE: bcrypt requires libffi-dev
# NOTE: bcryptor requires python-dev & Cython
# NOTE: bcryptor isn't py3 compatible, so only tested under py2
#===========================================================================

# note: used this just to check legacy issues, not generally needed.
;[testenv:bcrypt1.0-py2]
;basepython = python2
;deps =
;    {[testenv:py27]_mindeps}
;    bcrypt<1.1
;commands =
;    nosetests {posargs:--randomize passlib.tests.test_handlers_bcrypt}

[testenv:other-bcrypt-py2]
basepython = python2
deps =
    {[testenv:py27]_mindeps}
    bcryptor
    py-bcrypt
commands =
    nosetests {posargs:--randomize passlib.tests.test_handlers_bcrypt}

[testenv:other-bcrypt-py3]
basepython = python3
deps =
    {[testenv]_mindeps}
    py-bcrypt
commands =
    nosetests {posargs:--randomize passlib.tests.test_handlers_bcrypt}

#---------------------------------------------------------------------
# the "wo-bcrypt" environments makes sure code is ok w/o
# any bcrypt library installed.
#
# NOTE: running *all* tests, not just bcrypt ones --
#       had a few registry related tests fail when bcrypt is missing.
#---------------------------------------------------------------------

[testenv:wo-bcrypt-py2]
setenv =
    PASSLIB_TEST_MODE = quick
basepython = python2
deps =
    {[testenv:py27]_mindeps}
commands =
    nosetests {posargs:--randomize passlib.tests}

[testenv:wo-bcrypt-py3]
setenv =
    PASSLIB_TEST_MODE = quick
basepython = python3
deps =
    {[testenv]_mindeps}
commands =
    nosetests {posargs:--randomize passlib.tests}

#===========================================================================
# Django integration testing
#
# currently supports Django 1.6+
#
# there are tests for the major django versions at the time of release,
# short the latest version, which is handled by the 'django' test.
#
# All django releases are testing with bcrypt installed,
# there is special test which runs w/o bcrypt.
#
# NOTE: django doesn't seem to work well with py-bcrypt or bcryptor,
#       so those backends aren't tested.
#===========================================================================

#---------------------------------------------------------------------
# legacy django verions that are py2/py3
#---------------------------------------------------------------------
[testenv:django16-py3]
basepython = python3
deps =
    {[testenv]deps}
    django<1.7
commands =
    nosetests {posargs:--randomize passlib.tests.test_ext_django passlib.tests.test_handlers_django}

[testenv:django17-py3]
basepython = python3
deps =
    {[testenv]deps}
    django<1.8
commands =
    nosetests {posargs:--randomize passlib.tests.test_ext_django passlib.tests.test_handlers_django}

#---------------------------------------------------------------------
# latest django version
#---------------------------------------------------------------------

# NOTE: django >= 1.7 distributes tests as part of source, not the package,
#       so for full integration tests to run, have a copy of the latest django source,
#       and set the env var PASSLIB_TESTS_DJANGO_SOURCE_PATH to point to it.
[testenv:django-py2]
basepython = python2
deps =
    {[testenv:py27]deps}
    django
passenv =
    PASSLIB_TESTS_DJANGO_SOURCE_PATH
commands =
    nosetests {posargs:--randomize passlib.tests.test_ext_django passlib.tests.test_handlers_django}

[testenv:django-py3]
basepython = python3
deps =
    {[testenv]deps}
    django
passenv =
    PASSLIB_TESTS_DJANGO_SOURCE_PATH
commands =
    nosetests {posargs:--randomize passlib.tests.test_ext_django passlib.tests.test_handlers_django}

#---------------------------------------------------------------------
# make sure we're ok w/ django but w/o bcrypt
#---------------------------------------------------------------------
[testenv:django-wo-bcrypt-py3]
basepython = python3
deps =
    {[testenv:wo-bcrypt-py3]deps}
    django
commands =
    nosetests {posargs:--randomize passlib.tests.test_ext_django passlib.tests.test_handlers_django}

#===========================================================================
# PyPy VM
# NOTE: PyPy 2.4.0 targets Python 2.7 & Python 3.2
#===========================================================================
[testenv:pypy]
basepython = pypy
deps = {[testenv:py27]deps}

[testenv:pypy3]
basepython = pypy3

#===========================================================================
# Jython VM
#
# NOTE: not run by default
#===========================================================================
[testenv:jython27]
basepython = jython2.7

#===========================================================================
# Google App Engine integration
#
# NOTE: for this to work, the GAE SDK should be installed in
#       /usr/local/google_appengine, or set nosegae's --gae-lib-root
#
# NOTE: not run by default
#===========================================================================
[testenv:gae-py27]
basepython = python2.7
deps =
    nose
    nosegae
    unittest2
changedir = {envdir}/lib/python2.7/site-packages
commands =
    # setup custom app.yaml so GAE can run
    python -m passlib.tests.tox_support setup_gae . python27

    # run tests
    nosetests --with-gae {posargs:passlib/tests}

#===========================================================================
# eof
#===========================================================================