summaryrefslogtreecommitdiff
path: root/tox.ini
blob: e148ea6c7be86a0fb4cb210843c50187de82af98 (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
#===========================================================================
# Passlib configuration for TOX
#===========================================================================
#
#-----------------------------------------------------------------------
# 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 where possible,
#        additional time is devoted to fuzz testing.
#
#-----------------------------------------------------------------------
# external library integration tests
#-----------------------------------------------------------------------
# There are a bunch of optional libraries.  For the most part,
# the convention here is that the 'default' tests check with all the recommended
# libraries installed; and then individual envs are added which run a restricted
# set of the affected tests, exercising the alternate backends.
#===========================================================================

#===========================================================================
# global config
#===========================================================================
[tox]
minversion=2.3
envlist =
    # default tests
    # TODO: would like to 'default-pyston' but doesnt quite work
    # TODO: also add default-jython27
    # NOTE: removed 2.6 & 3.3 as of 2019-11, tox+pip no longer work for these versions.
    default-py{35,36,37,38,39,py3},

    # pbkdf2 backend testing
    # NOTE: 'hashlib' takes priority under py34+
    #       'from-bytes' used for py33 (since hashlib not present)
    #       'unpack' used for py2
    ## pdbkf2-fastpbkdf2-py{2,3}, # tested by default config
    pbkdf2-hashlib-py{3,py3},
    pbkdf2-frombytes-py{3,py3},

    # bcrypt backend testing (bcrypt cffi tested by default test)
    ## bcrypthash-bcrypt-py{2,3,py,py3}, # tested by default config
    bcrypthash-{builtin,disabled}-py{3,py3}

    # scrypt backend testing (builtin backend tested by default test)
    # XXX: 'scrypt' not compatible w/ pypy, or would include this under default.
    #      could still do that for all but pypy, and do special test for builtin.
    scrypthash-scrypt-py3,
    ## scrypthash-stdlib-py{3},  # will only work for py36+ && openssl 1.1+
    ## scrypthash-builtin-py{2,3,py,py3},  # tested by default config

    # argon2 backend testing (argon2_cffi tested by default test)
    ## argon2hash-argon2cffi-py{2,3,py,py3}  # tested by default config
    argon2hash-argon2pure-py{3,py3},

    # django tests
    # NOTE: django distributes it'a tests as part of source, not the package, so for full
    #       integration tests to run, caller must provide a copy of the latest django source,
    #       and set the env var PASSLIB_TESTS_DJANGO_SOURCE_PATH to point to it.
    # django support roadmap -- https://www.djangoproject.com/download/
    # django python versions -- https://docs.djangoproject.com/en/3.1/faq/install/#what-python-version-can-i-use-with-django
    django-dj{Latest,31,30,22,21,20,1x,18}-wdeps-py3,
    django-dj{Latest}-nodeps-py3,

    # other tests
    docs

#===========================================================================
# common env configuration
#===========================================================================
[testenv]
basepython =
    py3: python3
    py35: python3.5
    py36: python3.6
    py37: python3.7
    py38: python3.8
    py39: python3.9

    pypy3: pypy3

passenv =
    PASSLIB_TEST_MODE
    PASSLIB_TESTS_DJANGO_SOURCE_PATH
    NOSE_REDNOSE
    NOSE_REDNOSE_COLOR

setenv =
    # test mode setup
    PASSLIB_TEST_MODE = {env:PASSLIB_TEST_MODE:full}
    bcrypthash-builtin: PASSLIB_BUILTIN_BCRYPT = enabled
    bcrypthash-disabled: PASSLIB_TEST_MODE = quick

    # option that depends on rednose (see below)
    HIDE_SKIPS = --hide-skips

    # nose option fragments
    with_coverage: TEST_COVER_OPTS = --with-xunit --with-coverage --cover-xml --cover-package passlib
    TEST_OPTS = {env:HIDE_SKIPS:} --randomize {env:TEST_COVER_OPTS:}

changedir = {envdir}
commands =
    # default tests
    default: nosetests {posargs:{env:TEST_OPTS} passlib.tests}

    # crypto backend tests
    pbkdf2: nosetests {posargs:{env:TEST_OPTS} passlib.tests.test_crypto_digest passlib.tests.test_handlers_pbkdf2}

    # hash backend tests
    bcrypthash: nosetests {posargs:{env:TEST_OPTS} passlib.tests.test_handlers_bcrypt}
    scrypthash: nosetests {posargs:{env:TEST_OPTS} passlib.tests.test_crypto_scrypt passlib.tests.test_handlers_scrypt}
    argon2hash: nosetests {posargs:{env:TEST_OPTS} passlib.tests.test_handlers_argon2}

    # django tests
    django: nosetests {posargs:{env:TEST_OPTS} passlib.tests.test_ext_django passlib.tests.test_handlers_django}

deps =
    # common
    nose
    rednose
    coverage
    randomize

    # totp helper tests
    # NOTE: cryptography requires python-dev, libffi-dev, libssl-dev
    # XXX: 2016-6-20: having issue w/ cryptography under pypy, disabling it for now
    default-!pypy{,3}: cryptography

    # pbkdf2 backend tests
    # NOTE: fastpbkdf2 requires python-dev, libffi-dev, libssl-dev
    default,pbkdf2-fastpbkdf2: fastpbkdf2
    # pbkdf2-{hashlib,unpack,from_bytes} -- no deps

    # bcrypt backend tests
    # NOTE: bcrypt requires python-dev, libffi-dev
    # NOTE: bcryptor is py2 only, requires python-dev & Cython
    # NOTE: bcrypt10 env disabled, just used to check legacy issues
    ## bcrypthash-bcrypt10: bcrypt<1.1
    default,bcrypthash-bcrypt: bcrypt

    # scrypt backend tests
    # XXX: would test 'scrypt' under default, but not compatible w/ pypy,
    #      so using default test to check builtin backend;
    #      could just omit it from pypy tests instead.
    scrypthash-scrypt: scrypt
    # scrypthash-builtin -- nodeps

    # argon2 backend tests
    # NOTE: argon2_cffi requires python-dev, libffi-dev
    default,argon2hash-argon2cffi: argon2_cffi
    argon2hash-argon2pure: argon2pure

    # django extension tests
    dj18: django<1.9
    dj1x: django<2.0
    dj20: django<2.1
    dj21: django<2.2
    dj22: django<3.0
    dj30: django<3.1
    dj31: django<3.2
    djLatest: django
    django-wdeps: bcrypt
    # django-nodeps -- would like to use this as negative dependancy for 'bcrypt' instead

    # needed by django's internal tests
    # XXX: does django still need this as of py35?
    django: mock

#===========================================================================
# build documentation
#===========================================================================
[testenv:docs]
basepython = python
changedir = docs
deps =
    sphinx
commands =
    pip install -r requirements.txt
    sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
    python -c 'print("HTML_DEST_DIR={envtmpdir}/html")'

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