Skip to content

Commit da85e98

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. Install coverage < 5.0 to work around a problem with sqlite. python-ldap should move to pytest eventually. Fixes: #326 Signed-off-by: Christian Heimes <cheimes@redhat.com>
1 parent 7e084ae commit da85e98

File tree

3 files changed

+32
-25
lines changed

3 files changed

+32
-25
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: 3 additions & 5 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

@@ -88,7 +84,9 @@ env:
8884

8985
install:
9086
- pip install "pip>=7.1.0"
91-
- pip install tox-travis tox codecov coverage
87+
- pip install tox-travis tox codecov
88+
# See https://github.com/nedbat/coveragepy/issues/915
89+
- pip install "coverage<5.0"
9290

9391
script: CFLAGS="$CFLAGS_warnings $CFLAGS_std" tox
9492

tox.ini

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,50 +9,58 @@ envlist = py27,py34,py35,py36,py37,py38,py39,{py2,py3}-nosasltls,doc,py3-trace,c
99
minver = 1.8
1010

1111
[testenv]
12-
deps = coverage
12+
# coverag 5.0.2 is failing with "sqlite3.OperationalError: disk I/O error"
13+
# https://github.com/nedbat/coveragepy/issues/915
14+
deps = coverage < 5.0
1315
passenv = WITH_GCOV
1416
# - Enable BytesWarning
1517
# - Turn all warnings into exceptions.
1618
# - 'ignore:the imp module is deprecated' is required to ignore import of 'imp'
1719
# in distutils. Python < 3.6 use PendingDeprecationWarning; Python >= 3.6 use
1820
# DeprecationWarning.
21+
# - 'ignore:lib2to3 package' for Python 3.9
1922
commands = {envpython} -bb -Werror \
2023
"-Wignore:the imp module is deprecated:DeprecationWarning" \
2124
"-Wignore:the imp module is deprecated:PendingDeprecationWarning" \
2225
"-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
26+
"-Wignore:lib2to3 package is deprecated and may not be able to parse Python 3.10+:PendingDeprecationWarning" \
27+
-m coverage run --parallel -m unittest discover -v -s Tests -p 't_*'
2628

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

3336
[testenv:py34]
3437
# No warnings with Python 3.4
3538
passenv = {[testenv]passenv}
36-
commands = {envpython} \
37-
-m coverage run --parallel setup.py test
39+
commands = {[testenv:py27]commands}
3840

3941
[testenv:py2-nosasltls]
4042
basepython = python2
41-
deps = {[testenv]deps}
43+
# don't install, install dependencies manually
44+
skip_install = true
45+
deps =
46+
{[testenv]deps}
47+
pyasn1
48+
pyasn1_modules
4249
passenv = {[testenv]passenv}
4350
setenv =
4451
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
52+
# build and install without SASL and TLS, run without LDAPI
53+
commands =
54+
{envpython} setup.py clean --all
55+
{envpython} setup.py build_ext -UHAVE_SASL,HAVE_TLS
56+
{envpython} setup.py install --single-version-externally-managed --root=/
57+
{[testenv:py27]commands}
5158

5259
[testenv:py3-nosasltls]
5360
basepython = python3
54-
deps = {[testenv]deps}
55-
passenv = {[testenv]passenv}
61+
skip_install = {[testenv:py2-nosasltls]skip_install}
62+
deps = {[testenv:py2-nosasltls]deps}
63+
passenv = {[testenv:py2-nosasltls]passenv}
5664
setenv = {[testenv:py2-nosasltls]setenv}
5765
commands = {[testenv:py2-nosasltls]commands}
5866

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy