annotate command fails to annotate many files

smontanaro avatarsmontanaro 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
    Indicators_rigel_takeover.py,cover

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

Comments (4)

  1. smontanaro

    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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.