same issue #161 coverage warning "no data was collected" issue Create issue Issue #161

Issue #653 closed
Former user created an issue

the error raise "coverage warning "no data was collected" because .pyx file are not analysed by coverage.py.
I do not understand why it's not working

I used in setup.py file for compilation
define_macros=[('CYTHON_TRACE', '1'), ('CYTHON_TRACE_NOGIL','1')],
compiler_directives={'embedsignature': True, 'linetrace': True,
Do I miss something

Comments (3)

  1. domieb

    Unfortunately the project is not yet on a public github,
    I copy my setup at the end.

    I compil with:
    python3 setup.py build_ext --inplace --define CYTHON_TRACE

    and i expect the followed command for test coverge :

    python3 -m nose iw/test/test_intertwining_wavelet.py
    or
    python3 -m unittest iw/test/test_intertwining_wavelet.py
    do not leads to code coverage of sources

    Do you see something wrong , any thing that can help

    thanks
    dom

    part of setup.py file:

    import re, os, sys
    import shutil
    from distutils.core import setup, Extension
    from distutils.command.clean import clean as _clean
    from distutils.dir_util import remove_tree
    from distutils.command.sdist import sdist

    Test if Cython is installed

    USE_CYTHON = True

    try:
    from Cython.Distutils import build_ext
    except:
    USE_CYTHON = False
    raise 'Cannot build iw without cython'
    sys.exit()

    try:
    import numpy
    except:
    raise 'Cannot build iw without numpy'
    sys.exit()

    PATH_INCLUDES = [numpy.get_include(), '.', './iw/test', 'iw/multiresolution',
    './iw', './iw/reconstruction', './iw/function_fab', './iw/diaconis_fill',
    './iw/kernel_c']

    PATH_LIBRARIES = ['build', os.path.abspath("./kernel_c"), '.'] # ICI+'/lib'
    LINK_LIBRARIES = ["m", ]

    EXTRA_COMPIL_ARGS = ['-g', ]

    ext_modules = [Extension("iw.function_fab.stairsum",
    ["iw/function_fab/stairsum.pyx", ],
    include_dirs=PATH_INCLUDES,
    library_dirs=PATH_LIBRARIES,
    libraries=LINK_LIBRARIES,
    ),
    Extension("iw.diaconis_fill.complementschur",
    ["iw/diaconis_fill/complementschur.pyx", ],
    include_dirs=PATH_INCLUDES,
    library_dirs=PATH_LIBRARIES,
    libraries=LINK_LIBRARIES,
    ),
    Extension("iw.diaconis_fill.cal_beta_gamma",
    ["iw/diaconis_fill/cal_beta_gamma.pyx", ],
    include_dirs=PATH_INCLUDES,
    library_dirs=PATH_LIBRARIES,
    libraries=LINK_LIBRARIES,
    ),
    Extension("iw.multiresolution.sparsify_matrix",
    ["iw/multiresolution/sparsify_matrix.pyx", ],
    include_dirs=PATH_INCLUDES,
    library_dirs=PATH_LIBRARIES,
    libraries=LINK_LIBRARIES,
    ),
    Extension("iw.multiresolution.tab_one_step_Lambda",
    ["iw/multiresolution/tab_one_step_Lambda.pyx", ],
    include_dirs=PATH_INCLUDES,
    library_dirs=PATH_LIBRARIES,
    libraries=LINK_LIBRARIES,
    ),
    Extension("iw.reconstruction.operateur_reconstruction_one_step",
    ["iw/reconstruction/operateur_reconstruction_one_step.pyx",],
    include_dirs=PATH_INCLUDES,
    library_dirs=PATH_LIBRARIES,
    libraries=LINK_LIBRARIES,
    ),
    Extension("iw.graph_c",
    ["iw/graph_c.pyx",
    "iw/kernel_c/cuore.c", "iw/kernel_c/lodge.c",
    "iw/kernel_c/rforest_internal.c"],
    include_dirs=PATH_INCLUDES,
    library_dirs=PATH_LIBRARIES,
    include_path=PATH_INCLUDES,
    libraries=LINK_LIBRARIES,
    extra_compile_args=EXTRA_COMPIL_ARGS,
    ),
    Extension("iw.multiresolution.struct_multires_Lbarre",
    ["iw/multiresolution/struct_multires_Lbarre.pyx",
    "iw/reconstruction/operateur_reconstruction_one_step.pyx",
    "iw/graph_c.pyx", "iw/kernel_c/cuore.c", "iw/kernel_c/lodge.c",
    "iw/kernel_c/rforest_internal.c"],
    include_dirs=PATH_INCLUDES,
    library_dirs=PATH_LIBRARIES,
    include_path=PATH_INCLUDES,
    libraries=LINK_LIBRARIES,
    extra_compile_args=EXTRA_COMPIL_ARGS,
    ),
    Extension("iw.reconstruction.tab_compute_multires_coeffs_sparse",
    ["iw/reconstruction/tab_compute_multires_coeffs_sparse.pyx",
    "iw/multiresolution/struct_multires_Lbarre.pyx", ],
    include_dirs=PATH_INCLUDES,
    library_dirs=PATH_LIBRARIES,
    libraries=LINK_LIBRARIES,
    ),
    Extension("iw.reconstruction.tab_reconstruction_multires",
    ["iw/reconstruction/tab_reconstruction_multires.pyx",
    "iw/multiresolution/struct_multires_Lbarre.pyx", ],
    include_dirs=PATH_INCLUDES,
    library_dirs=PATH_LIBRARIES,
    libraries=LINK_LIBRARIES,
    include_path=PATH_INCLUDES,
    extra_compile_args=EXTRA_COMPIL_ARGS,

                         ),
               Extension("iw.intertwining_wavelet",
                         ["iw/intertwining_wavelet.pyx",
                          "iw/graph_c.pyx",
                          "iw/multiresolution/struct_multires_Lbarre.pyx",
                          "iw/reconstruction/tab_reconstruction_multires.pyx",
                          "iw/reconstruction/tab_compute_multires_coeffs_sparse.pyx", "iw/kernel_c/cuore.c", "iw/kernel_c/lodge.c",
                          "iw/kernel_c/rforest_internal.c"],
                         include_dirs=PATH_INCLUDES,
                         library_dirs=PATH_LIBRARIES,
                         libraries=LINK_LIBRARIES,
                         include_path=PATH_INCLUDES,
                         extra_compile_args=EXTRA_COMPIL_ARGS,
                         ), ]
    

    Setup method

    def setup_package():
    """ Setup function"""
    # set version
    VERSION = get_version()
    iw_dir = 'iw'
    set_version(iw_dir, VERSION)
    setup(
    name="IntertwiningWavelet",
    version=VERSION,
    description="IntertwiningWavelet : Pyramidal algorithms for wavelett decomposition on Graph",
    author="Labex Archimede AMU",
    author_email="",
    packages=['iw', 'iw.test', 'iw.function_fab',
    'iw.diaconis_fill', 'iw.multiresolution',
    'iw.reconstruction'],
    package_dir={'iw': 'iw',
    'iw.function_fab': 'iw/function_fab',
    'iw.diaconis_fill': 'iw/diaconis_fill',
    'iw.multiresolution': 'iw/multiresolution',
    'iw.reconstruction': 'iw/reconstruction',
    },
    package_data={'iw': ['.pxd'], 'iw.function_fab': ['.pxd'],
    'iw.diaconis_fill': ['.pxd'], 'iw.multiresolution': ['.pxd'],
    'iw.reconstruction': ['*.pxd'], },
    ext_modules=ext_modules,
    install_requires=['numpy>=1.8', 'scipy>=0.16'],
    test_suite='nose.collector',
    tests_require=['nose', 'coverage'],
    define_macros=[('CYTHON_TRACE', '1'), ('CYTHON_TRACE_NOGIL', '1')],
    compiler_directives={'embedsignature': True, 'linetrace': True,
    'binding': True, 'profile': True, },
    cmdclass={'build_ext': build_ext, 'clean': clean, 'sdist': m_sdist},
    )

    and .coveragerc file:

    .coveragerc to control coverage.py

    [run]
    branch = True
    plugins = Cython.Coverage
    source = iw

    include = /iw/

    [report]

    Regexes for lines to exclude from consideration

    exclude_lines =
    # Have to re-enable the standard pragma
    pragma: no cover

    # Don't complain about missing debug-only code:
    def __repr__
    if self\.debug
    
    # Don't complain if tests don't hit defensive assertion code:
    raise AssertionError
    raise NotImplementedError
    
    # Don't complain if non-runnable code isn't run:
    if 0:
    if __name__ == .__main__.:
    

    ignore_errors = True

    [paths]

    source = .

    ./iw

    ./iw/multiresolution

    ./iw/reconstruction

    ./iw/diaconis_fill

    ./iw/function_fab

  2. Log in to comment