[TIP] CoverageWarning: Couldn't parse Python file

Ned Batchelder ned at nedbatchelder.com
Sun Apr 10 16:16:32 PDT 2022


You are already naming the cython plugin in your coverage configuration 
file, but that error sounds like the plugin isn't enabled properly.  I 
don't know why that would be.

--Ned.

On 4/8/22 12:45 PM, Jose, Nimi wrote:
>
> Hello,
>
> I would like to ask for help with the coverage measurement issue I am 
> facing.
>
> Environment used:
> 1. Coverage.py 6.3.1 with C extension
>
> 2. Gcc 9.4
>
> 3. Cython 0.29.28
> 4. Linux-x86
>
> 5. def_encoding: utf-8
>
> 6. fs_encoding: utf-8
>
> 7. python3.8
>
> Folder Structure:
> _/usr/lib/python3.8/site-packages
> --- Source_
>
> _-- file.py
> --file2.pyx
>   --- Test
> -- test_file.py_
>
> _--_init_.py_
>
> _   --_test_
> Content in my .coveragerc is:
> [run]
> plugins = Cython.Coverage
>
> I have my Source/setup.py with:
> #####################################################################
>
> # Arguments for compilation
>
> #####################################################################
>
> # Directives to be passed to the Cythonize generator
>
> cython_directives = {
>
> "embedsignature": True,
>
> "language_level": 3,
>
> }
>
> # Directives to be passed to distutils extensions compiler
>
> distutils_macros = []
>
> cython_directives['linetrace'] = True
>
> cython_directives['binding'] = True
>
> distutils_macros.append(('CYTHON_TRACE_NOGIL', '1'))
>
> After successfully run the command coverage run , coverage report 
> generating warnings says:
> /usr/lib/python3.8/site-packages/coverage/report.py:81: 
> CoverageWarning: Couldn't parse Python file 
> '/usr/lib/python3.8/site-packages/source/file2.pyx' (couldnt-parse)
>
>  coverage._warn(msg, slug="couldnt-parse")
>
> And coverage report does not contain any data regarding cython symbols.
>
> Can you please help me to figure out the issue with cython files? What 
> will be the reason for this parsing error and what is the solution for it?
>
> Looking forward to hearing from you.
>
> Thanks in advance!
>
> Regards,
>
> Nimi Jose
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20220410/ebf04a26/attachment.html>


More information about the testing-in-python mailing list