summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Madden <jamadden@gmail.com>2020-01-21 09:36:15 -0600
committerJason Madden <jamadden@gmail.com>2020-01-21 09:38:45 -0600
commit35f349bb364ff47c6d617384a2c7eb4c3257be8b (patch)
tree493c77345035b7855dd6dc5f3e1bbf11ff765f90
parente76d03f51909c2b3f8cdad38eb91fa5f523b5e2e (diff)
downloadzope-interface-35f349bb364ff47c6d617384a2c7eb4c3257be8b.tar.gz
Tweaks for coverage reporting.
And tox. It wasn't properly working to report coverage before.
-rw-r--r--setup.py2
-rw-r--r--src/zope/interface/_compat.py4
-rw-r--r--tox.ini36
3 files changed, 24 insertions, 18 deletions
diff --git a/setup.py b/setup.py
index 455fcc3..e053bfa 100644
--- a/setup.py
+++ b/setup.py
@@ -77,7 +77,7 @@ if is_jython:
else:
ext_modules = codeoptimization
tests_require = [
- 'coverage',
+ 'coverage >= 5.0.3',
'zope.event',
]
testing_extras = tests_require
diff --git a/src/zope/interface/_compat.py b/src/zope/interface/_compat.py
index 1a834d5..c25362d 100644
--- a/src/zope/interface/_compat.py
+++ b/src/zope/interface/_compat.py
@@ -89,7 +89,7 @@ def _c_optimizations_available():
try:
from zope.interface import _zope_interface_coptimizations as c_opt
return c_opt
- except catch:
+ except catch: # pragma: no cover (only Jython doesn't build extensions)
return False
@@ -151,7 +151,7 @@ def _use_c_impl(py_impl, name=None, globs=None):
return py_impl
c_opt = _c_optimizations_available()
- if not c_opt:
+ if not c_opt: # pragma: no cover (only Jython doesn't build extensions)
return py_impl
__traceback_info__ = c_opt
diff --git a/tox.ini b/tox.ini
index a87df5e..2c60a50 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,26 +1,33 @@
[tox]
envlist =
- py27,py27-pure,py35,py35-pure,py36,py37,py38,pypy,pypy3,coverage,docs
+ py27,py27-pure,py35,py35-pure,py36,py37,py38,py38-cext,pypy,pypy3,coverage,docs
# NB: if you add new environments, please also add them to depends in
# testenv:coverage so that parallel runs (tox -p auto) will work correctly
[testenv]
-skip_install = true
+# ``usedevelop`` is required otherwise unittest complains that it
+# discovers a file in src/... but imports it from .tox/.../
+# ``skip_install`` also basically works, but that causes the ``extras``
+# not to be installed (though ``deps`` still are), and doesn't
+# rebuild C extensions.
+usedevelop = true
commands =
- coverage run -m unittest discover -s src
+ coverage run -p -m unittest discover -s src
extras = test
-setenv =
- COVERAGE_FILE=.coverage.{envname}
+
[testenv:py27-pure]
setenv =
PURE_PYTHON=1
- PIP_CACHE_DIR = {envdir}/.cache
[testenv:py35-pure]
setenv =
PURE_PYTHON=1
- PIP_CACHE_DIR = {envdir}/.cache
+
+[testenv:py38-cext]
+# Require the C extension
+setenv =
+ PURE_PYTHON=0
[testenv:py]
commands =
@@ -28,16 +35,15 @@ commands =
{[testenv]commands}
[testenv:coverage]
-setenv =
- COVERAGE_FILE=.coverage
-skip_install = true
+# The -i/--ignore arg is necessary; we get
+# No source for code: '//.tox/pypy/site-packages/zope/interface/__init__.py'
+# without it.
commands =
- coverage erase
coverage combine
- coverage report
- coverage html
- coverage xml
-depends = py27,py27-pure,py35,py35-pure,py36,py37,py38,pypy,pypy3
+ coverage report -i
+ coverage html -i
+ coverage xml -i
+depends = py27,py27-pure,py35,py35-pure,py36,py37,py38,py38-cext,pypy,pypy3
parallel_show_output = true
[testenv:docs]