Skip to content

Commit 3d67963

Browse files
committed
Tox: replace setup.py test with unittest discover
setup.py test is deprecated and causes issues with testing our code. There are cases where the wrong shared library is picked up. The ``unittest discover`` approach avoids building the extension twice. python-ldap should move to pytest eventually. Fixes: #326 Signed-off-by: Christian Heimes <cheimes@redhat.com>
1 parent 7e084ae commit 3d67963

File tree

2 files changed

+24
-19
lines changed

2 files changed

+24
-19
lines changed

.coveragerc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
[run]
22
branch = True
33
source =
4-
Lib/
5-
omit =
6-
Lib/slapdtest.py
4+
ldap
5+
ldif
6+
ldapurl
7+
slapdtest
78

89
[paths]
910
source =

tox.ini

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,39 +20,43 @@ commands = {envpython} -bb -Werror \
2020
"-Wignore:the imp module is deprecated:DeprecationWarning" \
2121
"-Wignore:the imp module is deprecated:PendingDeprecationWarning" \
2222
"-Wignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working:DeprecationWarning" \
23-
-m coverage run --parallel setup.py \
24-
clean --all \
25-
test
23+
-m coverage run --parallel -m unittest discover -s Tests -p 't_*'
2624

2725
[testenv:py27]
2826
# No warnings with Python 2.7
2927
passenv = {[testenv]passenv}
30-
commands = {envpython} \
31-
-m coverage run --parallel setup.py test
28+
commands =
29+
{envpython} -m coverage run --parallel \
30+
-m unittest discover -s Tests -p 't_*'
3231

3332
[testenv:py34]
3433
# No warnings with Python 3.4
3534
passenv = {[testenv]passenv}
36-
commands = {envpython} \
37-
-m coverage run --parallel setup.py test
35+
commands = {[testenv:py27]commands}
3836

3937
[testenv:py2-nosasltls]
4038
basepython = python2
41-
deps = {[testenv]deps}
39+
# don't install, install dependencies manually
40+
skip_install = true
41+
deps =
42+
{[testenv]deps}
43+
pyasn1
44+
pyasn1_modules
4245
passenv = {[testenv]passenv}
4346
setenv =
4447
CI_DISABLED=LDAPI:SASL:TLS
45-
# rebuild without SASL and TLS, run without LDAPI
46-
commands = {envpython} \
47-
-m coverage run --parallel setup.py \
48-
clean --all \
49-
build_ext -UHAVE_SASL,HAVE_TLS \
50-
test
48+
# build and install without SASL and TLS, run without LDAPI
49+
commands =
50+
{envpython} setup.py clean --all
51+
{envpython} setup.py build_ext -UHAVE_SASL,HAVE_TLS
52+
{envpython} setup.py install --single-version-externally-managed --root=/
53+
{[testenv:py27]commands}
5154

5255
[testenv:py3-nosasltls]
5356
basepython = python3
54-
deps = {[testenv]deps}
55-
passenv = {[testenv]passenv}
57+
skip_install = {[testenv:py2-nosasltls]skip_install}
58+
deps = {[testenv:py2-nosasltls]deps}
59+
passenv = {[testenv:py2-nosasltls]passenv}
5660
setenv = {[testenv:py2-nosasltls]setenv}
5761
commands = {[testenv:py2-nosasltls]commands}
5862

0 commit comments

Comments
 (0)