Issue #57 resolved

annotate command fails to annotate many files

created an issue

I just upgraded to the latest version of the coverage module. We have a reasonably complex installation of internal Python modules at work. I made a long test run overnight and this morning asked for a coverage report. It looked fine:

{{{ Name Stmts Exec Cover ------------------------------------------------------------------------------------------------------------------------ /home/udesktop116/skipm/src/tl/prefix/lib/pythonpath/snakemodels/init 2 2 100% /home/udesktop116/skipm/src/tl/prefix/lib/pythonpath/snakemodels/basketrule/init 1 1 100% ... 241 lines elided ... /opt/tradelink/share/research/site-packages.stable/numpy/testing/nosetester 135 32 23% /opt/tradelink/share/research/site-packages.stable/numpy/testing/numpytest 34 9 26% /opt/tradelink/share/research/site-packages.stable/numpy/testing/utils 278 29 10% /opt/tradelink/share/research/site-packages.stable/numpy/version 11 11 100% Indicators/rigel_takeover 822 632 76% ------------------------------------------------------------------------------------------------------------------------ TOTAL 27945 12583 45% }}}

Then I asked it to generate annotated listings:

{{{ % coverage annotate -d cover }}}

Looking in my cover directory I only saw one file:

{{{ % ls -l cover total 75 -rw-rw-r-- 1 skipm snake 76230 Mar 18 09:15,cover }}}

How do I get it to generate coverage output for the other 240+ modules?

Comments (6)

  1. smontanaro reporter

    I figured out what was preventing annotation. In AnnotateReport.annotate_file it explicitly checks to see if a file is not a relative path. Commenting out that check makes things work for me.

    I'm not sure what the ultimate solution is, but simply considering files absolute paths as uninteresting seems to be too blunt an instrument.

  2. Anonymous

    I just hit a similar issue with the same solution. Not sure why annotate depends on the code unit being a relative path??

    annotate.annotate_file: line 50

    coverage version, 3.4

    Please note, I experienced this by using the API calls directly for annotate and html output:

            tmp_dir = os.path.join(coverage_base_dir_new, "annotated_text")
            self.coverage.annotate(morfs = self.modules,
                                      directory = tmp_dir,
                                      ignore_errors = False,
                                      omit = self.omit_list)
            tmp_dir = os.path.join(coverage_base_dir_new, "annotated_html")
            self.coverage.html_report(morfs = self.modules,
                                      directory = tmp_dir,
                                      ignore_errors = False,
                                      omit = self.omit_list)

    Same calls, same data, annotate returns nothing and html returns it all.

  3. Log in to comment