Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoverageWarning: Couldn't parse '.../(test)' #93

Closed
mtelka opened this issue Feb 16, 2023 · 3 comments
Closed

CoverageWarning: Couldn't parse '.../(test)' #93

mtelka opened this issue Feb 16, 2023 · 3 comments

Comments

@mtelka
Copy link

mtelka commented Feb 16, 2023

python -m pytest reports the following coverage warning:

/usr/lib/python3.9/vendor-packages/coverage/report.py:114: CoverageWarning: Couldn't parse '/tmp/zipp-3.13.0/(test)': No source for code: '/tmp/zipp-3.13.0/(test)'. (couldnt-parse

The problem is caused by this line:
https://github.com/jaraco/zipp/blob/v3.13.0/tests/test_zipp.py#L278

@jaraco
Copy link
Owner

jaraco commented Feb 16, 2023

I've encountered similar spurious errors from pytest-cov in pytest-dev/pytest-cov#538.

@jaraco
Copy link
Owner

jaraco commented Feb 16, 2023

I am able to replicate the issue outside of pytest-cov:

 zipp main $ .tox/python/bin/coverage run .tox/python/bin/pytest -p no:cov
=========================================================================== test session starts ===========================================================================
platform darwin -- Python 3.11.1, pytest-7.2.1, pluggy-1.0.0
rootdir: /Users/jaraco/code/jaraco/zipp, configfile: pytest.ini
plugins: enabler-2.1.0, black-0.3.12, mypy-0.10.3, checkdocs-2.9.0, flake8-1.1.1
collected 77 items                                                                                                                                                        

conftest.py s..s                                                                                                                                                    [  5%]
. .                                                                                                                                                                 [  6%]
docs/conf.py s.s                                                                                                                                                    [ 10%]
tests/__init__.py s.s                                                                                                                                               [ 14%]
tests/_context.py ....                                                                                                                                              [ 19%]
tests/_func_timeout_compat.py ...                                                                                                                                   [ 23%]
tests/_test_params.py s.s                                                                                                                                           [ 27%]
tests/test_zipp.py ....s........................................                                                                                                    [ 86%]
zipp/__init__.py .......                                                                                                                                            [ 96%]
zipp/py310compat.py s.s                                                                                                                                             [100%]
================================================================================== mypy ===================================================================================

Success: no issues found in 9 source files
===================================================================== 65 passed, 11 skipped in 6.81s ======================================================================
 zipp main $ .tox/python/bin/coverage report
No source for code: '/Users/jaraco/code/jaraco/zipp/(test)'.

@jaraco
Copy link
Owner

jaraco commented Feb 16, 2023

It looks as if the proper fix for this general case of failures might be to suppress those 'couldnt-parse' warnings, but in this particular case, I believe the test is no longer adding any value, as it was there to address compatibility on Python 2, so I'll probably just remove the test.

@jaraco jaraco closed this as completed in 8b1e203 Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants