Skip to content

Commit def231c

Browse files
authored
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. python-ldap#335 Fixes: python-ldap#326 Signed-off-by: Christian Heimes <cheimes@redhat.com>
1 parent c8427c0 commit def231c

File tree

3 files changed

+26
-23
lines changed

3 files changed

+26
-23
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 =

.travis.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ matrix:
6767
- python: 3.6
6868
env: TOXENV=doc
6969
allow_failures:
70-
- env:
71-
- TOXENV=py39
72-
- CFLAGS_std="-std=c99"
73-
- WITH_GCOV=1
7470
- env:
7571
- TOXENV=pypy
7672

tox.ini

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,43 +16,49 @@ passenv = WITH_GCOV
1616
# - 'ignore:the imp module is deprecated' is required to ignore import of 'imp'
1717
# in distutils. Python < 3.6 use PendingDeprecationWarning; Python >= 3.6 use
1818
# DeprecationWarning.
19+
# - 'ignore:lib2to3 package' for Python 3.9
1920
commands = {envpython} -bb -Werror \
2021
"-Wignore:the imp module is deprecated:DeprecationWarning" \
2122
"-Wignore:the imp module is deprecated:PendingDeprecationWarning" \
2223
"-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
24+
"-Wignore:lib2to3 package is deprecated and may not be able to parse Python 3.10+:PendingDeprecationWarning" \
25+
-m coverage run --parallel -m unittest discover -v -s Tests -p 't_*'
2626

2727
[testenv:py27]
2828
# No warnings with Python 2.7
2929
passenv = {[testenv]passenv}
30-
commands = {envpython} \
31-
-m coverage run --parallel setup.py test
30+
commands =
31+
{envpython} -m coverage run --parallel \
32+
-m unittest discover -v -s Tests -p 't_*'
3233

3334
[testenv:py34]
3435
# No warnings with Python 3.4
3536
passenv = {[testenv]passenv}
36-
commands = {envpython} \
37-
-m coverage run --parallel setup.py test
37+
commands = {[testenv:py27]commands}
3838

3939
[testenv:py2-nosasltls]
4040
basepython = python2
41-
deps = {[testenv]deps}
41+
# don't install, install dependencies manually
42+
skip_install = true
43+
deps =
44+
{[testenv]deps}
45+
pyasn1
46+
pyasn1_modules
4247
passenv = {[testenv]passenv}
4348
setenv =
4449
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
50+
# build and install without SASL and TLS, run without LDAPI
51+
commands =
52+
{envpython} setup.py clean --all
53+
{envpython} setup.py build_ext -UHAVE_SASL,HAVE_TLS
54+
{envpython} setup.py install --single-version-externally-managed --root=/
55+
{[testenv:py27]commands}
5156

5257
[testenv:py3-nosasltls]
5358
basepython = python3
54-
deps = {[testenv]deps}
55-
passenv = {[testenv]passenv}
59+
skip_install = {[testenv:py2-nosasltls]skip_install}
60+
deps = {[testenv:py2-nosasltls]deps}
61+
passenv = {[testenv:py2-nosasltls]passenv}
5662
setenv = {[testenv:py2-nosasltls]setenv}
5763
commands = {[testenv:py2-nosasltls]commands}
5864

0 commit comments

Comments
 (0)