Skip to content

Commit afd4372

Browse files
committed
Try to set up coverage
1 parent 361edd5 commit afd4372

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

.coveragerc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[run]
2+
plugins = Cython.Coverage

setup.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,18 @@
2323

2424
from setuptools import Extension, find_packages, setup
2525

26-
EXTENSION_OPTS = {}
26+
EXTENSION_OPTS = dict(compiler_directives={})
2727

2828
# Make sure conda prefix is loaded if installed in a conda environment.
2929
CONDA_PREFIX = os.environ.get("CONDA_PREFIX")
3030
if CONDA_PREFIX:
3131
EXTENSION_OPTS["include_dirs"] = [os.path.join(CONDA_PREFIX, "include")]
3232

33+
CYTHON_COVERAGE=os.environ.get("CYTHON_COVERAGE", False)
34+
if CYTHON_COVERAGE:
35+
EXTENSION_OPTS["compiler_directives"]["linetrace"] = True
36+
EXTENSION_OPTS["define_macros"] = [("CYTHON_TRACE", 1)]
37+
3338
setup(
3439
name="isal",
3540
version="0.1.0-dev",
@@ -45,7 +50,7 @@
4550
zip_safe=False,
4651
packages=find_packages('src'),
4752
package_dir={'': 'src'},
48-
package_data={'isal': ['*.pxd']},
53+
package_data={'isal': ['*.pxd', '*.pyx']},
4954
url="https://github.com/rhpvorderman/python-isal",
5055
classifiers=[
5156
"Programming Language :: Python :: 3 :: Only",

src/isal/isal_zlib.pyx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
# cython: language_level=3
2222

23+
2324
import warnings
2425
import zlib
2526

tox.ini

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@
33
# python3 interpreter of the user.
44
envlist=py3
55
[testenv]
6+
setenv=
7+
CYTHON_COVERAGE=True
68
deps=coverage
79
pytest
10+
cython
11+
allowlist_externals=
12+
cp
813
commands =
914
# Create HTML coverage report for humans and xml coverage report for external services.
10-
coverage run --source=isal -m py.test -v tests
15+
coverage run --source={envsitepackagesdir}/isal -m py.test -v tests
1116
coverage html
1217
coverage xml
18+
cython --annotate-coverage coverage.xml {envsitepackagesdir}/isal/isal_zlib.pyx
19+
cp {envsitepackagesdir}/isal/isal_zlib.html htmlcov/
1320

1421
[testenv:lint]
1522
deps=flake8

0 commit comments

Comments
 (0)