Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pruning dir-filename in coverage.py html report

When testing some code using coverage.py I stumbled over a problem with too long filenames under windows: the python code to be tested lies pretty well nested somethwere deep in some directory. Down there I also would like to create the actual html report using

coverage.py html

which ends in some failure, that some file does not exist. The problem: the length of the directory string + lenght of filename string is just too long (nice combination of windows problem + my complicated directory structure).

My solution right now: I configure the file .coveragerc such that the html report is written somewhere at c:\tmp\report, which works fine. However, later this task should run somehwere on a Jenkins server, and there I am bound to some longer directory.

My question: why does coverage.py html need to create these very long filenames, including all the directory? Is there any way to prune these filename such that common preambles are ommited?

like image 636
Sosel Avatar asked Jan 26 '17 14:01

Sosel


1 Answers

To answer your specific question, it doesn't! Not anymore, that is. Since around version 6.0, coverage.py uses a different file naming approach, which results in shorter filenames. See: https://github.com/nedbat/coveragepy/issues/580 and the commit that fixes it here: https://github.com/nedbat/coveragepy/commit/4d05ddeeded7f3f594c0614630f467e1bf3fa629

If this is still an issue for you, I recommend updating your coverage package and see if that helps.

like image 181
youngmit Avatar answered Nov 03 '22 06:11

youngmit