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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With