File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed
Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 11[build-system ]
22requires = [" setuptools>=51" , " cython>=0.29" , " wheel" ]
33build-backend = " setuptools.build_meta"
4+
5+ [tool .coverage .run ]
6+ plugins = [" Cython.Coverage" ]
Original file line number Diff line number Diff line change 2525import tempfile
2626from pathlib import Path
2727
28+ from Cython .Build import cythonize
29+
2830from setuptools import Extension , find_packages , setup
2931from setuptools .command .build_ext import build_ext
3032
@@ -62,6 +64,17 @@ def build_extension(self, ext):
6264 ext .extra_objects = [
6365 os .path .join (isa_l_prefix_dir , "lib" , "libisal.a" )]
6466
67+ if os .getenv ("CYTHON_COVERAGE" ) is not None :
68+ # Add cython directives and macros for coverage support.
69+ cythonized_exts = cythonize (ext , compiler_directives = dict (
70+ linetrace = True
71+ ))
72+ for cython_ext in cythonized_exts :
73+ cython_ext .define_macros = [("CYTHON_TRACE_NOGIL" , "1" )]
74+ cython_ext ._needs_stub = False
75+ super ().build_extension (cython_ext )
76+ return
77+
6578 super ().build_extension (ext )
6679
6780
Original file line number Diff line number Diff line change 33# python3 interpreter of the user.
44envlist =py3
55[testenv]
6- deps =coverage
6+ deps =coverage[toml]
7+ cython
78 pytest
89passenv =
910 PYTHON_ISAL_LINK_DYNAMIC
11+ setenv =
12+ CYTHON_COVERAGE =true
1013commands =
1114 # Create HTML coverage report for humans and xml coverage report for external services.
1215 coverage run --source ={envsitepackagesdir}/isal -m py.test -v tests
You can’t perform that action at this time.
0 commit comments