[TIP] "coverage annotate -d DIR" creates no output

Masiar, Peter (PMASIAR) PMASIAR at arinc.com
Wed Jan 8 11:57:42 PST 2014


I guess I will post workaround I found, "to help the next guy" (TM)

In file annotate.py, in function annotate_file(), I commented out test for cu.relative:

    def annotate_file(self, cu, analysis):
        #if not cu.relative:
        #    return

After that, output for all files was generated in desired directory, similar to HTML coverage.

Thank you!

-----Original Message-----
From: Ned Batchelder [mailto:nedbat at gmail.com] On Behalf Of Ned Batchelder
Sent: Thursday, December 12, 2013 6:33 AM
To: Masiar, Peter (PMASIAR)
Cc: testing-in-python at lists.idyll.org
Subject: Re: [TIP] "coverage annotate -d DIR" creates no output


On 12/11/13 3:37 PM, Masiar, Peter (PMASIAR) wrote:
> Folks,
> First, thank you for coverage - it's excellent tool.
>
> Of course you will hear from users like me only if something goes 
> wrong :-)
>
> I was able to create test coverage for our unit tests, and "coverage report" and "coverage html" work OK. Happy camper.
>
> When I try "coverage annotate -d covtxt", I got no output. It does create directory "covtxt", but it remains empty. I tried annotate in shell with COVERAGE_PROCESS_START variable and without, no difference.
>
> What I am doing wrong? Thank you.

That sounds very odd, the code is very similar between report, html, and annotate.  We can debug it off-list and report back when we've found the answer.

First: are you sure you want annotate output?  It's always seemed clumsy to me.  It's a hold-over for backward compatibility from the very early days of coverage.py, and I'd be glad to just drop support for it.  I didn't realize people actually valued it! :)

But let's suppose you do want it.  Can you either provide me with a tarball of a reproducible failure, or can you debug inside coverage.py's annotate.py file to get some more details?

--Ned.
> Here is result of  "coverage debug sys" on my box:
> ===================================
> coverage debug sys >coverage_debug.txt
>
> cat coverage_debug.txt
> -- sys ----------------------------------------
>          version: 3.7
>         coverage: /usr/lib/python2.6/site-packages/coverage-3.7-py2.6-linux-x86_64.egg/coverage/__init__.pyc
>        cover_dir: /usr/lib/python2.6/site-packages/coverage-3.7-py2.6-linux-x86_64.egg/coverage
>       pylib_dirs: /usr/lib/python2.6
>           tracer: CTracer
>     config_files: .coveragerc
>     configs_read: .coveragerc
>        data_path: /home/pmasiar/mycoverage/.coverage
>           python: 2.6.6 (r266:84292, Jun 16 2011, 15:06:25) [GCC 4.4.3]
>         platform: Linux-3.4.2-1-ARCH-x86_64-Intel-R-_Xeon-R-_CPU_E5440_ at _2.83GHz-with-glibc2.2.5
>   implementation: CPython
>       executable: /usr/local/bin/python
>              cwd: /home/pmasiar/mycoverage
>             path: /usr/bin
>                   /usr/lib/python2.6/site-packages/django_piston-0.2.2-py2.6.egg
>                   /usr/lib/python2.6/site-packages/RBTools-0.4.1-py2.6.egg
>                   /usr/lib/python2.6/site-packages/coverage-3.7-py2.6-linux-x86_64.egg
>                   /home/pmasiar/adc/lib
>                   /home/pmasiar/adc/bin
>                   /home/pmasiar/adc/acc_test
>                   /home/pmasiar/adc/unit_test
>                   /home/pmasiar/adc/acc_test/sabre_test
>                   /home/pmasiar/adc/acc_test/navtech_test
>                   /home/pmasiar/adc/tools
>                   /usr/local/Webware
>                   /home/pmasiar/adc/wwwroot
>                   /home/pmasiar/adc/wwwroot/lib
>                   /home/pmasiar/adc_test/scripts/fitnesse
>                   /home/pmasiar/adc_test/utils/twill-extensions
>                   /usr/local/pgsql/bin
>                   /usr/local/pgsql/lib
>                   /home/pmasiar/adc
>                   /home/pmasiar/adc/WebServices
>                   /home/pmasiar/adc/src/pgms/RedisQueueProcessors
>                   /home/pmasiar/adc/src/pgms/gribs
>                   /usr/lib/python26.zip
>                   /usr/lib/python2.6
>                   /usr/lib/python2.6/plat-linux2
>                   /usr/lib/python2.6/lib-tk
>                   /usr/lib/python2.6/lib-old
>                   /usr/lib/python2.6/lib-dynload
>                   /usr/lib/python2.6/site-packages
>                   /usr/lib/python2.6/site-packages/PIL
>                   /usr/lib/python2.6/site-packages/ZopePageTemplates
>                   /usr/lib/python2.6/site-packages/gtk-2.0
>                   /usr/lib/python2.6/site-packages/selenium
>                   /usr/lib/python2.6/site-packages/template_utils-0.4p2-py2.6.egg-info
>                   /usr/lib/python2.6/site-packages/twill-0.9-py2.6.egg-info
>                   /usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode
>      environment: COVERAGE_PROCESS_START = /home/pmasiar/mycoverage/.coveragerc
>                   PYDOC_PORT = 7464
>                   PYTHONOPTS = -u
>                   PYTHONPATH = /home/pmasiar/adc/lib:/home/pmasiar/adc/bin:/home/pmasiar/adc/acc_test:/home/pmasiar/adc/unit_test:/home/pmasiar/adc/acc_test/sabre_test:/home/pmasiar/adc/acc_test/navtech_test:/home/pmasiar/adc/tools:/usr/local/Webware:/home/pmasiar/adc/wwwroot:/home/pmasiar/adc/wwwroot/lib:/home/pmasiar/adc_test/scripts/fitnesse:/home/pmasiar/adc_test/utils/twill-extensions:/usr/local/pgsql/bin:/home/pmasiar/adc_test/utils/twill-extensions:/usr/local/pgsql/lib:/home/pmasiar/adc:/home/pmasiar/adc/WebServices:/home/pmasiar/adc/src/pgms/RedisQueueProcessors:/home/pmasiar/adc/src/pgms/gribs
>                   PYTHONSTARTUP = /home/pmasiar/.pythonrc.py
>     command_line: /usr/bin/coverage debug sys ────── Peter Masiar 
> ARINC Direct  │ QA ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> This e-mail (including any attachments) is intended only for the use of the individual or entity named above and may contain privileged, proprietary, or confidential information. The information may also contain technical data subject to export control laws.
>
>
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python




More information about the testing-in-python mailing list