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

No source for code: '<path to project>/config-3.py' thrown when generating report #1653

Closed
james-ro-williams opened this issue Jul 12, 2023 · 12 comments
Labels
bug Something isn't working not our bug The problem was elsewhere

Comments

@james-ro-williams
Copy link

Describe the bug
After having run coverage, I try to generate a report using coverage report -m --omit="tests/*","*__init__.py". No report is generated and I'm greeted with this error:

No source for code: '<path to project>/config-3.py'.

This error is encountered in version: 7.2.7

To Reproduce
Python: 3.9.16
Pipenv: 2023.3.20
Coverage version: 7.2.7
Output of coverage debug sys:

-- sys -------------------------------------------------------
               coverage_version: 7.2.7
                coverage_module: <homedir>/.local/share/virtualenvs/project-JOMLCQNb/lib/python3.9/site-packages/coverage/__init__.py
                         tracer: -none-
                        CTracer: available
           plugins.file_tracers: -none-
            plugins.configurers: -none-
      plugins.context_switchers: -none-
              configs_attempted: .coveragerc
                                 setup.cfg
                                 tox.ini
                                 pyproject.toml
                   configs_read: -none-
                    config_file: None
                config_contents: -none-
                      data_file: -none-
                         python: 3.9.16 (main, Apr 14 2023, 08:46:32) [GCC 9.4.0]
                       platform: Linux-5.4.0-146-generic-x86_64-with-glibc2.31
                 implementation: CPython
                     executable: <homedir>/.local/share/virtualenvs/project-JOMLCQNb/bin/python
                   def_encoding: utf-8
                    fs_encoding: utf-8
                            pid: 4130002
                            cwd: <path_to_root_of_project>
                           path: <homedir>/.local/share/virtualenvs/project-JOMLCQNb/bin
                                 <homedir>/.pyenv/versions/3.9.16/lib/python39.zip
                                 <homedir>/.pyenv/versions/3.9.16/lib/python3.9
                                 <homedir>/.pyenv/versions/3.9.16/lib/python3.9/lib-dynload
                                 <homedir>/.local/share/virtualenvs/project-JOMLCQNb/lib/python3.9/site-packages
                    environment: HOME = <homedir>
                                 PIP_PYTHON_PATH = <homedir>/.local/pipx/venvs/pipenv/bin/python
                                 PYENV_ROOT = <homedir>/.pyenv
                                 PYENV_SHELL = zsh
                                 PYTHONDONTWRITEBYTECODE = 1
                   command_line: <homedir>/.local/share/virtualenvs/project-JOMLCQNb/bin/coverage debug sys
         sqlite3_sqlite_version: 3.31.1
             sqlite3_temp_store: 0
        sqlite3_compile_options: COMPILER=gcc-9.4.0, ENABLE_COLUMN_METADATA, ENABLE_DBSTAT_VTAB,
                                 ENABLE_FTS3, ENABLE_FTS3_PARENTHESIS, ENABLE_FTS3_TOKENIZER, ENABLE_FTS4,
                                 ENABLE_FTS5, ENABLE_JSON1, ENABLE_LOAD_EXTENSION, ENABLE_PREUPDATE_HOOK,
                                 ENABLE_RTREE, ENABLE_SESSION, ENABLE_STMTVTAB, ENABLE_UNLOCK_NOTIFY,
                                 ENABLE_UPDATE_DELETE_LIMIT, HAVE_ISNAN, LIKE_DOESNT_MATCH_BLOBS,
                                 MAX_SCHEMA_RETRY=25, MAX_VARIABLE_NUMBER=250000, OMIT_LOOKASIDE,
                                 SECURE_DELETE, SOUNDEX, TEMP_STORE=1, THREADSAFE=1, USE_URI

Output of pip freeze:

alembic==1.11.1
artifacts-keyring==0.3.3
bcrypt==4.0.1
black==23.7.0
bleach==6.0.0
blinker==1.6.2
build==0.10.0
certifi==2021.10.8
cffi==1.15.1
charset-normalizer==2.1.1
click==8.1.4
cloudpickle==2.2.1
colorama==0.4.6
coloredlogs==15.0.1
contourpy==1.1.0
coverage==7.2.7
cryptography==41.0.2
cycler==0.11.0
databricks-cli==0.17.7
docker==6.1.3
docutils==0.20.1
internal-package==2.3.0
entrypoints==0.4
flake8==6.0.0
Flask==2.3.2
flatbuffers==23.5.26
fonttools==4.40.0
gitdb==4.0.10
GitPython==3.1.32
greenlet==2.0.2
grpcio==1.56.0
grpcio-tools==1.56.0
gunicorn==20.1.0
humanfriendly==10.0
idna==3.4
importlib-metadata==6.8.0
importlib-resources==6.0.0
itsdangerous==2.1.2
jaraco.classes==3.3.0
jeepney==0.8.0
Jinja2==3.1.2
joblib==1.3.1
keyring==24.2.0
kiwisolver==1.4.4
Mako==1.2.4
Markdown==3.4.3
markdown-it-py==3.0.0
MarkupSafe==2.1.3
matplotlib==3.7.2
mccabe==0.7.0
mdurl==0.1.2
mlflow==2.4.2
more-itertools==9.1.0
mpmath==1.3.0
mss==9.0.1
mypy-extensions==1.0.0
ntplib==0.4.0
numpy==1.25.1
oauthlib==3.2.2
onnx==1.14.0
onnxruntime-openvino==1.15.0
opencv-python==4.8.0.74
packaging==21.3
pandas==2.0.3
paramiko==3.2.0
pathspec==0.11.1
Pillow==10.0.0
pip-system-certs==4.0
pkginfo==1.9.6
platformdirs==3.8.1
prometheus-client==0.17.1
protobuf==4.23.4
psutil==5.9.5
pyarrow==12.0.1
pycodestyle==2.10.0
pycparser==2.21
pyflakes==3.0.1
Pygments==2.15.1
PyJWT==2.7.0
PyNaCl==1.5.0
pyparsing==3.0.9
pyproject_hooks==1.0.0
pysftp==0.2.9
python-certifi-win32==1.6.1
python-dateutil==2.8.2
python-logging-loki==0.3.1
pytz==2023.3
PyYAML==5.4.1
querystring-parser==1.2.4
readme-renderer==40.0
requests==2.31.0
requests-toolbelt==1.0.0
rfc3339==6.2
rfc3986==2.0.0
rich==13.4.2
scikit-learn==1.3.0
scipy==1.11.1
SecretStorage==3.3.3
setuptools-scm==7.1.0
six==1.16.0
smmap==5.0.0
SQLAlchemy==2.0.18
sqlparse==0.4.4
sympy==1.12
tabulate==0.9.0
threadpoolctl==3.1.0
tomli==2.0.1
twine==4.0.2
typing_extensions==4.7.1
tzdata==2023.3
urllib3==1.26.16
vistir==0.6.1
webencodings==0.5.1
websocket-client==1.6.1
Werkzeug==2.3.6
wrapt==1.15.0
zipp==3.16.0

Packages are managed using pipenv, and Python versions are managed using pyenv.

Commands to reproduce:
pipenv lock --dev; pipenv sync --dev; pipenv run coverage run -m unittest discover; pipenv run coverage report -m --omit="tests/*","*__init__.py"

This error can also be reproduced when running coverage outside of the pipenv's virtualenv (installed via pipx).

Since this project is sensitive I can't give any more information than that.

Expected behavior
A report to be shown of my test coverage.

@james-ro-williams james-ro-williams added bug Something isn't working needs triage labels Jul 12, 2023
@nedbat
Copy link
Owner

nedbat commented Jul 12, 2023

Do you have a file named config-3.py? Are you generating files like that? It's hard to offer help without more information.

BTW: I recommend measuring your tests with coverage also: https://nedbatchelder.com/blog/202008/you_should_include_your_tests_in_coverage.html

@james-ro-williams
Copy link
Author

There's no file named config-3.py in my repo, and we're not generating any files of that name.

@nedbat
Copy link
Owner

nedbat commented Jul 13, 2023

I'm not sure how to help. If you can make a reproducible case for me, I can dig deeper.

@robin-wayve
Copy link

Here's a reproduction with opencv-python @ 4.6.0.66 and coverage @ 7.2.7 (in a virtualenv with python 3.8)

bug.py

def example():
   import cv2

test_bug.py

from bug import example
from unittest import TestCase


class ExampleTest(TestCase):
    def test_example(self):
        example()

Run:

coverage run -m unittest discover
.
----------------------------------------------------------------------
Ran 1 test in 0.166s

OK

Report:

> coverage report
No source for code: '/home/robin/cov-repro/config-3.py'.

Not really sure what opencv-python does but it maybe creates this file at install time

> find .venv -type f -name config-3.py
.venv/lib/python3.8/site-packages/cv2/config-3.py

@robin-wayve
Copy link

I mean, I guess the workaround is you specify --ignore-errors

/home/robin/cov-repro/.venv/lib/python3.8/site-packages/coverage/report_core.py:113: CoverageWarning: Couldn't parse '/home/robin/cov-repro/config-3.py': No source for code: '/home/robin/c
ov-repro/config-3.py'. (couldnt-parse)
  coverage._warn(msg, slug="couldnt-parse")
/home/robin/cov-repro/.venv/lib/python3.8/site-packages/coverage/report_core.py:113: CoverageWarning: Couldn't parse '/home/robin/cov-repro/config.py': No source for code: '/home/robin/cov
-repro/config.py'. (couldnt-parse)
  coverage._warn(msg, slug="couldnt-parse")
Name          Stmts   Miss  Cover
---------------------------------
bug.py            2      0   100%
test_bug.py       5      0   100%
---------------------------------
TOTAL             7      0   100%

@nedbat
Copy link
Owner

nedbat commented Jul 27, 2023

Another option is to add this to your coverage settings (.coveragerc, etc):

[run]
omit = 
    config.py
    config-3.py

The files are created in the current directory, so I don't see a way to automatically understand that they are synthetic.

@nedbat nedbat added the not our bug The problem was elsewhere label Jul 27, 2023
@nedbat nedbat closed this as completed Jul 27, 2023
@robin-wayve
Copy link

@nedbat could coverage make a manifest of files that are present at the beginning of coverage run and then exclude any newly appearing files during coverage report? perhaps optionally?

@nedbat
Copy link
Owner

nedbat commented Jul 28, 2023

It's an interesting idea...

@scott-phase3d
Copy link

scott-phase3d commented Jun 6, 2024

Just wanted to add that I am experiencing this issue as well. I believe it's related to opencv.

We are running python 3.11.9, coverage 7.22, and opencv-python 4.10.0.82

Our plan is to use omit in .coveragerc as our solution.

Full conda environment

# Name                    Version                   Build  Channel
alabaster                 0.7.12             pyhd3eb1b0_0
aom                       3.6.0                hd77b12b_0
arrow                     1.2.3           py311haa95532_1
aspose-3d                 24.5.0                   pypi_0    pypi
asteval                   0.9.33                   pypi_0    pypi
astroid                   2.14.2          py311haa95532_0
asttokens                 2.0.5              pyhd3eb1b0_0
atomicwrites              1.4.0                      py_0
attrs                     23.1.0          py311haa95532_0
autopep8                  2.0.4              pyhd3eb1b0_0
babel                     2.11.0          py311haa95532_0
bcrypt                    3.2.0           py311h2bbff1b_1
beautifulsoup4            4.12.2          py311haa95532_0
beeprint                  2.4.11                   pypi_0    pypi
binaryornot               0.4.4              pyhd3eb1b0_1
black                     24.4.2          py311haa95532_0
blas                      1.0                         mkl
bleach                    4.1.0              pyhd3eb1b0_0
blosc                     1.21.3               h6c2663c_0
brotli                    1.0.9                h2bbff1b_8
brotli-bin                1.0.9                h2bbff1b_8
brotli-python             1.0.9           py311hd77b12b_8
bzip2                     1.0.8                h2bbff1b_6
ca-certificates           2024.3.11            haa95532_0
certifi                   2024.6.2        py311haa95532_0
cffi                      1.16.0          py311h2bbff1b_1
cfitsio                   3.470                h2bbff1b_7
chardet                   4.0.0           py311haa95532_1003
charls                    2.2.0                h6c2663c_0
charset-normalizer        2.0.4              pyhd3eb1b0_0
click                     8.1.7           py311haa95532_0
cloudpickle               2.2.1           py311haa95532_0
colorama                  0.4.6           py311haa95532_0
comm                      0.2.1           py311haa95532_0
contourpy                 1.2.0           py311h59b6b97_0
cookiecutter              2.6.0           py311haa95532_0
coverage                  7.2.2           py311h2bbff1b_0
cryptography              42.0.5          py311h89fc84f_1
cuda-nvrtc                12.4.127             hd77b12b_1
cuda-version              12.4                 hbda6634_3
cupy                      13.1.0          py311h25580cd_4    conda-forge
cupy-core                 13.1.0          py311h9faa33c_4    conda-forge
cycler                    0.11.0             pyhd3eb1b0_0
dav1d                     1.2.1                h2bbff1b_0
debugpy                   1.6.7           py311hd77b12b_0
decorator                 5.1.1              pyhd3eb1b0_0
defusedxml                0.7.1              pyhd3eb1b0_0
diff-match-patch          20200713           pyhd3eb1b0_0
dill                      0.3.8           py311haa95532_0
docstring-to-markdown     0.11            py311haa95532_0
docutils                  0.18.1          py311haa95532_3
executing                 0.8.3              pyhd3eb1b0_0
fastrlock                 0.8.2           py311h12c1d0e_2    conda-forge
flake8                    7.0.0           py311haa95532_0
fonttools                 4.51.0          py311h2bbff1b_0
freetype                  2.12.1               ha860e81_0
giflib                    5.2.1                h8cc25b3_3
humanize                  3.10.0             pyhd3eb1b0_0
icc_rt                    2022.1.0             h6049295_2
icu                       73.1                 h6c2663c_0
idna                      3.7             py311haa95532_0
imagecodecs               2023.1.23       py311he6ff3c7_0
imageio                   2.33.1          py311haa95532_0
imagesize                 1.4.1           py311haa95532_0
importlib-metadata        7.0.1           py311haa95532_0
importlib_metadata        7.0.1                hd3eb1b0_0
inflection                0.5.1           py311haa95532_0
intel-openmp              2023.1.0         h59b6b97_46320
intervaltree              3.1.0              pyhd3eb1b0_0
ipykernel                 6.28.0          py311haa95532_0
ipython                   8.20.0          py311haa95532_0
isort                     5.9.3              pyhd3eb1b0_0
jaraco.classes            3.2.1              pyhd3eb1b0_0
jedi                      0.18.1          py311haa95532_1
jellyfish                 1.0.1           py311h36a85e1_0
jinja2                    3.1.4           py311haa95532_0
jpeg                      9e                   h2bbff1b_1
jsonschema                4.19.2          py311haa95532_0
jsonschema-specifications 2023.7.1        py311haa95532_0
jupyter_client            8.6.0           py311haa95532_0
jupyter_core              5.5.0           py311haa95532_0
jupyterlab_pygments       0.2.2           py311haa95532_0
keyboard                  0.13.5                   pypi_0    pypi
keyring                   24.3.1          py311haa95532_0
kiwisolver                1.4.4           py311hd77b12b_0
krb5                      1.20.1               h5b6d351_0
lazy-object-proxy         1.10.0          py311h2bbff1b_0
lazy_loader               0.3             py311haa95532_0
lcms2                     2.12                 h83e58a3_0
lerc                      3.0                  hd77b12b_0
libaec                    1.0.4                h33f27b4_1
libavif                   0.11.1               h2bbff1b_0
libbrotlicommon           1.0.9                h2bbff1b_8
libbrotlidec              1.0.9                h2bbff1b_8
libbrotlienc              1.0.9                h2bbff1b_8
libclang                  14.0.6          default_hb5a9fac_1
libclang13                14.0.6          default_h8e68704_1
libcublas                 12.4.5.8             hd77b12b_1
libcufft                  11.2.1.3             hd77b12b_1
libcurand                 10.3.5.147           hd77b12b_1
libcusolver               11.6.1.9             hd77b12b_1
libcusparse               12.3.1.170           hd77b12b_1
libdeflate                1.17                 h2bbff1b_1
libffi                    3.4.4                hd77b12b_1
libnvjitlink              12.4.127             hd77b12b_1
libpng                    1.6.39               h8cc25b3_0
libpq                     12.17                h906ac69_0
libsodium                 1.0.18               h62dcd97_0
libspatialindex           1.9.3                h6c2663c_0
libtiff                   4.5.1                hd77b12b_0
libwebp-base              1.3.2                h2bbff1b_0
libzopfli                 1.0.3                ha925a31_0
llvmlite                  0.42.0          py311hf2fb9eb_0
lmfit                     1.3.1                    pypi_0    pypi
lz4-c                     1.9.4                h2bbff1b_1
markdown-it-py            2.2.0           py311haa95532_1
markupsafe                2.1.3           py311h2bbff1b_0
matplotlib                3.8.4           py311haa95532_0
matplotlib-base           3.8.4           py311hf62ec03_0
matplotlib-inline         0.1.6           py311haa95532_0
mccabe                    0.7.0              pyhd3eb1b0_0
mdurl                     0.1.0           py311haa95532_0
mistune                   2.0.4           py311haa95532_0
mkl                       2023.1.0         h6b88ed4_46358
mkl-service               2.4.0           py311h2bbff1b_1
mkl_fft                   1.3.8           py311h2bbff1b_0
mkl_random                1.2.4           py311h59b6b97_0
more-itertools            10.1.0          py311haa95532_0
mss                       9.0.1                    pypi_0    pypi
mypy_extensions           1.0.0           py311haa95532_0
natsort                   7.1.1              pyhd3eb1b0_0
nbclient                  0.8.0           py311haa95532_0
nbconvert                 7.10.0          py311haa95532_0
nbformat                  5.9.2           py311haa95532_0
nest-asyncio              1.6.0           py311haa95532_0
networkx                  3.2.1           py311haa95532_0
numba                     0.59.1          py311hf62ec03_0
numpy                     1.26.4          py311hdab7c0b_0
numpy-base                1.26.4          py311hd01c5d8_0
numpydoc                  1.5.0           py311haa95532_0
opencv-python             4.10.0.82                pypi_0    pypi
openjpeg                  2.4.0                h4fc8c34_0
openssl                   3.0.13               h2bbff1b_2
packaging                 23.2            py311haa95532_0
pandocfilters             1.5.0              pyhd3eb1b0_0
paramiko                  2.8.1              pyhd3eb1b0_0
parso                     0.8.3              pyhd3eb1b0_0
pathspec                  0.10.3          py311haa95532_0
pexpect                   4.8.0              pyhd3eb1b0_3
pickleshare               0.7.5           pyhd3eb1b0_1003
pillow                    10.3.0          py311h2bbff1b_0
pillow-avif-plugin        1.4.3                    pypi_0    pypi
pip                       24.0            py311haa95532_0
platformdirs              3.10.0          py311haa95532_0
pluggy                    1.0.0           py311haa95532_1
ply                       3.11            py311haa95532_0
ppretty                   1.3                      pypi_0    pypi
progressbar2              4.2.0           py311haa95532_0
prompt-toolkit            3.0.43          py311haa95532_0
prompt_toolkit            3.0.43               hd3eb1b0_0
psutil                    5.9.0           py311h2bbff1b_0
ptyprocess                0.7.0              pyhd3eb1b0_2
pure_eval                 0.2.2              pyhd3eb1b0_0
pybind11-abi              5                    hd3eb1b0_0
pycodestyle               2.11.1          py311haa95532_0
pycparser                 2.21               pyhd3eb1b0_0
pydocstyle                6.3.0           py311haa95532_0
pyfakefs                  5.5.0                    pypi_0    pypi
pyflakes                  3.2.0           py311haa95532_0
pygments                  2.15.1          py311haa95532_1
pylint                    2.16.2          py311haa95532_0
pylint-venv               3.0.3           py311haa95532_0
pyls-spyder               0.4.0              pyhd3eb1b0_0
pynacl                    1.5.0           py311h8cc25b3_0
pyparsing                 3.0.9           py311haa95532_0
pyqt                      5.15.10         py311hd77b12b_0
pyqt5-sip                 12.13.0         py311h2bbff1b_0
pyqtwebengine             5.15.10         py311hd77b12b_0
pyserial                  3.5             py311haa95532_0
pysocks                   1.7.1           py311haa95532_0
python                    3.11.9               he1021f5_0
python-dateutil           2.9.0post0      py311haa95532_2
python-fastjsonschema     2.16.2          py311haa95532_0
python-lsp-black          2.0.0           py311haa95532_0
python-lsp-jsonrpc        1.1.2              pyhd3eb1b0_0
python-lsp-server         1.10.0          py311haa95532_0
python-slugify            5.0.2              pyhd3eb1b0_0
python-utils              3.3.3           py311haa95532_0
python_abi                3.11                    2_cp311    conda-forge
pytoolconfig              1.2.6           py311haa95532_0
pytz                      2024.1          py311haa95532_0
pywin32                   305             py311h2bbff1b_0
pywin32-ctypes            0.2.2           py311haa95532_0
pyyaml                    6.0.1           py311h2bbff1b_0
pyzmq                     25.1.2          py311hd77b12b_0
qdarkstyle                3.2.3              pyhd3eb1b0_0
qstylizer                 0.2.2           py311haa95532_0
qt-main                   5.15.2              h19c9488_10
qt-webengine              5.15.9               h5bd16bc_7
qtawesome                 1.2.2           py311haa95532_0
qtconsole                 5.5.1           py311haa95532_0
qtpy                      2.4.1           py311haa95532_0
referencing               0.30.2          py311haa95532_0
requests                  2.32.2          py311haa95532_0
rich                      13.3.5          py311haa95532_0
rope                      1.12.0          py311haa95532_0
rpds-py                   0.10.6          py311h062c2fa_0
rtree                     1.0.1           py311h2eaa2aa_0
scikit-image              0.22.0          py311hb4ba03d_0
scipy                     1.13.1          py311h9f229c6_0
screeninfo                0.8.1                    pypi_0    pypi
setuptools                69.5.1          py311haa95532_0
sip                       6.7.12          py311hd77b12b_0
six                       1.16.0             pyhd3eb1b0_1
snappy                    1.1.10               h6c2663c_1
snowballstemmer           2.2.0              pyhd3eb1b0_0
sortedcontainers          2.4.0              pyhd3eb1b0_0
soupsieve                 2.5             py311haa95532_0
sphinx                    5.0.2           py311haa95532_0
sphinxcontrib-applehelp   1.0.2              pyhd3eb1b0_0
sphinxcontrib-devhelp     1.0.2              pyhd3eb1b0_0
sphinxcontrib-htmlhelp    2.0.0              pyhd3eb1b0_0
sphinxcontrib-jsmath      1.0.1              pyhd3eb1b0_0
sphinxcontrib-qthelp      1.0.3              pyhd3eb1b0_0
sphinxcontrib-serializinghtml 1.1.5              pyhd3eb1b0_0
spyder                    5.5.1           py311haa95532_0
spyder-kernels            2.5.0           py311haa95532_0
sqlite                    3.45.3               h2bbff1b_0
stack_data                0.2.0              pyhd3eb1b0_0
tbb                       2021.8.0             h59b6b97_0
tenacity                  8.2.2           py311haa95532_0
text-unidecode            1.3                pyhd3eb1b0_0
textdistance              4.2.1              pyhd3eb1b0_0
three-merge               0.1.1              pyhd3eb1b0_0
tifffile                  2023.4.12       py311haa95532_0
tinycss2                  1.2.1           py311haa95532_0
tk                        8.6.14               h0416ee5_0
tomli                     2.0.1           py311haa95532_0
tomlkit                   0.11.1          py311haa95532_0
tornado                   6.3.3           py311h2bbff1b_0
traitlets                 5.7.1           py311haa95532_0
ttictoc                   0.5.6                    pypi_0    pypi
typing-extensions         4.12.1                   pypi_0    pypi
tzdata                    2024a                h04d1e81_0
ucrt                      10.0.20348.0         haa95532_0
ujson                     5.10.0          py311h5da7b33_0
uncertainties             3.2.0                    pypi_0    pypi
unicodedata2              15.1.0          py311h2bbff1b_0
unidecode                 1.2.0              pyhd3eb1b0_0
urllib3                   2.2.1           py311haa95532_0
urwid                     2.6.12                   pypi_0    pypi
vc                        14.2                 h2eaa2aa_1
vc14_runtime              14.38.33135         h835141b_20    conda-forge
vmbpy                     1.0.4                    pypi_0    pypi
vs2015_runtime            14.38.33135         h22015db_20    conda-forge
watchdog                  4.0.1           py311haa95532_0
wcwidth                   0.2.5              pyhd3eb1b0_0
webencodings              0.5.1           py311haa95532_1
whatthepatch              1.0.2           py311haa95532_0
wheel                     0.43.0          py311haa95532_0
win_inet_pton             1.1.0           py311haa95532_0
wrapt                     1.14.1          py311h2bbff1b_0
xz                        5.4.6                h8cc25b3_1
yaml                      0.2.5                he774522_0
yapf                      0.40.2          py311haa95532_0
zeromq                    4.3.5                hd77b12b_0
zfp                       1.0.0                hd77b12b_0
zipp                      3.17.0          py311haa95532_0
zlib                      1.2.13               h8cc25b3_1
zstd                      1.5.5                hd43e919_2

@scott-phase3d
Copy link

I can confirm that the following was a solution for us:

[run]
omit = 
    config.py
    config-3.py

georgemccabe added a commit to dtcenter/METcalcpy that referenced this issue Jun 13, 2024
…pencv is installed before running pytest code coverage. See nedbat/coveragepy#1653 for details
georgemccabe added a commit to dtcenter/METcalcpy that referenced this issue Jun 18, 2024
* add code coverage report to SonarQube

* modify unit tests so they can be run from any directory, not just the test directory

* call pytest from top directory and generate code coverage report for SonarQube

* fix deprecated warnings

* remove blank space

* install pytest-cov instead of coverage

* omit config-3.py from coverage to prevent error that is caused when opencv is installed before running pytest code coverage. See nedbat/coveragepy#1653 for details
@alejandroalfonsoyero
Copy link

[run]
omit = 
    config.py
    config-3.py

Worked for me

@John-Sharples
Copy link

For those using pyproject.toml

[tool.coverage.run]
omit = [
    "config.py",
    "config-3.py",
    ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working not our bug The problem was elsewhere
Projects
None yet
Development

No branches or pull requests

6 participants