opencv / opencv/opencv-python

PyTest Coverage Warning When Importing OpenCV

Open
#1,041 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.4k
Forks
1k
Avg merge
22h 17m
Merged PRs (30d)
3

Description

This issue is a continuation of this issue from coveragepy as the issue was closed because a workaround was found. This workaround still works, but the root problem still exists so I wanted to document it on this repo.

Expected behaviour

I would expect there to be no warnings.

Actual behaviour

The following warnings are thrown:

CoverageWarning: Couldn't parse '/home/mvine/Documents/test_coverage/config-3.py': No source for code: '/home/mvine/Documents/test_coverage/config-3.py'. (couldnt-parse)
Couldn't parse '/home/mvine/Documents/test_coverage/config.py': No source for code: '/home/mvine/Documents/test_coverage/config.py'. (couldnt-parse)
Steps to reproduce

This comment on this issue precisely demonstrates the steps to reproduce: https://github.com/nedbat/coveragepy/issues/1653#issuecomment-1653675347

Although there are several different ways to achieve this bug (such as running pytest --cov).

Issue submission checklist
  • This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
  • I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
  • The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
  • I'm using the latest version of opencv-python - opencv-python==4.10.0.84

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the linked coveragepy issue and the reported pytest --cov path with opencv-python==4.10.0.84. Determine whether the warning originates in this repository's build or test tooling, then verify that the reproduction completes without the reported CoverageWarning messages.

Written by the indexing model from the issue text.

Assessment

Tech stack
opencv, python
Domain
build-system, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.