Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

annotate command fails to annotate many files #57

Closed
nedbat opened this issue Mar 18, 2010 · 4 comments
Closed

annotate command fails to annotate many files #57

nedbat opened this issue Mar 18, 2010 · 4 comments
Labels
annotate bug Something isn't working

Comments

@nedbat
Copy link
Owner

nedbat commented Mar 18, 2010

Originally reported by smontanaro (Bitbucket: smontanaro, GitHub: smontanaro)


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?


@nedbat
Copy link
Owner Author

nedbat commented Mar 18, 2010

Original comment by smontanaro (Bitbucket: smontanaro, GitHub: 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.

@nedbat
Copy link
Owner Author

nedbat commented Oct 4, 2010

Original comment by 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:

#!python

        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.

@nedbat
Copy link
Owner Author

nedbat commented May 18, 2014

Fixed in 121d6cab4bf7 (bb)

@nedbat nedbat closed this as completed May 18, 2014
@nedbat
Copy link
Owner Author

nedbat commented Jul 29, 2014

Issue #321 was marked as a duplicate of this issue.

@nedbat nedbat added major bug Something isn't working annotate labels Jun 23, 2018
agronholm added a commit to agronholm/coveragepy that referenced this issue Aug 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
annotate bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant