question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

coverage tools fail on relative source path

See original GitHub issue

Originally reported by Dima Tisnek (Bitbucket: dimaqq, GitHub: dimaqq)


d = coverage.data.CoverageData(".coverage")
d.lines[FILENAME] = {7: None, 8:None, 11:None, 12: None}
d.write()

then coverage reportran from . where both .coverage and source.py are present, depending on FILENAME above, observed

  • source_that_doesnt_exist.py – complains that source cannot be found, ok
  • /full/path/to/source.py – no error, coverage 25%, ok
  • ./source.py – no error, coverage 0%, why?
  • source.py – no error, coverage 0%, why?

It appears that error reporting is not consistent with coverage reporting.

same for coverage html


Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
nedbatcommented, Feb 3, 2022

Feel free to re-open this if you can provide more information.

0reactions
manoadamrocommented, Nov 15, 2019

@nedbat I can’t even consistently reproduce it myself tbh, it just happens from time to time. Deleting all the cache files (basically everything except the actual source code files) seems fix it though. structure is:

project/
   project.py
   tests/
   setup.py
   venv/
Read more comments on GitHub >

github_iconTop Results From Across the Web

Option to use relative file paths in .coverage file #597 - GitHub
I test my project in a Docker container and then examine covered lines in PyCharm on my host machine. Currently PyCharm can only...
Read more >
IOS project code coverage source file is relative path
Hi,Jasper. I use lcov tool to generate html report with .gcda and .gcno files together,but I found the report missed a lot of...
Read more >
tools/code_coverage/coverage.py - chromium/src.git
Returns: A relative path to the generated profdata file. """ _BuildTargets(targets, jobs_count).
Read more >
Configuration reference — Coverage.py 6.4.4 documentation
The first value must be an actual file path on the machine where the reporting will happen, so that source code can be...
Read more >
D23922 [llvm-cov] Use the native path in the coverage report.
The coverage reports contain the source or binary file paths. On Windows, the file path might contain the separators of both '/' and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found