1. Ned Batchelder
  2. coverage.py
Issue #74 new

On Linux, packages get installed in places coverage.py doesn't ignore

Ned Batchelder
repo owner created an issue

Nikola Skoric reported on the nose-users list that too many packages were being measured, namely nose and lxml:

nick@rilmir:~/code/travapi$ coverage report                                            
Name                                                                                       Stmts   Exec  Cover                                                                            
--------------------------------------------------------------------------------------------------------------                                                                            
/usr/local/lib/python2.6/dist-packages/lxml-2.2.6-py2.6-linux-i686.egg/lxml/__init__           1      1   100%                                                                            
/usr/local/lib/python2.6/dist-packages/lxml-2.2.6-py2.6-linux-i686.egg/lxml/_elementpath     128     15    11%                                                                            
/usr/local/lib/python2.6/dist-packages/lxml-2.2.6-py2.6-linux-i686.egg/lxml/cssselect        610    336    55%                                                                            
/usr/local/lib/python2.6/dist-packages/nose/case                                             170     47    27%                                                                            
/usr/local/lib/python2.6/dist-packages/nose/core                                             154     22    14%                                                                            
/usr/local/lib/python2.6/dist-packages/nose/failure                                           20      8    40%                                                                            
/usr/local/lib/python2.6/dist-packages/nose/importer                                          92     53    57%                                                                            
/usr/local/lib/python2.6/dist-packages/nose/loader                                           331    136    41%                                                                            
/usr/local/lib/python2.6/dist-packages/nose/plugins/capture                                   53     14    26%                                                                            
/usr/local/lib/python2.6/dist-packages/nose/plugins/cover                                    164      5     3%                                                                            
/usr/local/lib/python2.6/dist-packages/nose/plugins/errorclass                                65     10    15%                                                                            
/usr/local/lib/python2.6/dist-packages/nose/plugins/logcapture                               120     15    12%                                                                            
/usr/local/lib/python2.6/dist-packages/nose/plugins/manager                                  261     39    14%                                                                            
/usr/local/lib/python2.6/dist-packages/nose/proxy                                             99     43    43%                                                                            
/usr/local/lib/python2.6/dist-packages/nose/result                                           128     31    24%                                                                            
/usr/local/lib/python2.6/dist-packages/nose/selector                                         130     71    54%                                                                            
/usr/local/lib/python2.6/dist-packages/nose/suite                                            379    180    47%                                                                            
/usr/local/lib/python2.6/dist-packages/nose/util                                             350     77    22%
test/test_account 15     15   100%
test/test_resources 28     27    96%
test/test_village 26     22    84%
travapi/__init__  1      1   100%
travapi/account 64     61    95%
travapi/const 17     17   100%
travapi/fetch134     92    68%
travapi/resources140    118    84%
travapi/village128    116    90%
--------------------------------------------------------------------------------------------------------------
TOTAL                                                                                       3808   1572    41%

His "coverage debug sys" output is:

nick@rilmir:~/code/travapi$ coverage debug sys
-- sys ----------------------------------------
        version: 3.3.1                         
       coverage: /usr/local/lib/python2.6/dist-packages/coverage/__init__.pyc
   cover_prefix: /usr/local/lib/python2.6/dist-packages/coverage             
   pylib_prefix: /usr/lib/python2.6                                          
         tracer: Tracer                                                      
      data_path: /media/data/home/code/travapi/.coverage                     
         python: 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3]  
       platform: Linux-2.6.28-18-generic-i686-with-Ubuntu-9.04-jaunty        
            cwd: /media/data/home/code/travapi                               
           path:                                                             
                 /usr/local/bin                                              
                 /usr/local/lib/python2.6/dist-packages/Whoosh-0.3.16-py2.6.egg
                 /usr/local/lib/python2.6/dist-packages/lxml-2.2.6-py2.6-linux-i686.egg
                 /usr/local/lib/python2.6/dist-packages/distribute-0.6.12-py2.6.egg    
                 /usr/local/lib/python2.6/dist-packages/pip-0.7.2-py2.6.egg            
                 /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/dist-packages                                      
                 /usr/lib/python2.6/dist-packages/PIL                                  
                 /var/lib/python-support/python2.6                                     
                 /var/lib/python-support/python2.6/gtk-2.0                             
                 /usr/local/lib/python2.6/dist-packages                                
    environment:                                                                       

He reports that he installed them with "pip install nose"

Comments (8)

  1. sourcefrog

    Somewhat related (but afaics a different codepath), on Ubuntu Precise, with coverage installed from python-coverage, it also fails to exclude itself from the report:

    % echo 'print 42' >> test.py
    % python-coverage erase
    % python-coverage run test.py
    42
    % python-coverage report
    Name                                     Stmts   Miss  Cover
    ------------------------------------------------------------
    /usr/share/pyshared/coverage/collector     132    127     4%
    /usr/share/pyshared/coverage/control       236    235     1%
    /usr/share/pyshared/coverage/execfile       35     16    54%
    test                                         2      0   100%
    ------------------------------------------------------------
    TOTAL                                      405    378     7%
    
  2. Ned Batchelder reporter

    From #python today, another report of this. Here's the "coverage debug sys":

    $ python-coverage debug sys
    -- sys ----------------------------------------
            version: 3.4
           coverage: /usr/lib/python2.7/dist-packages/coverage/__init__.pyc
          cover_dir: /usr/lib/python2.7/dist-packages/coverage
         pylib_dirs:
                     /usr/lib/python2.7
             tracer: Tracer
          data_path: /home/dev/vminstaller/.coverage
             python: 2.7.3 (default, Aug  1 2012, 05:14:39) [GCC 4.6.3]
           platform: Linux-3.2.0-33-generic-x86_64-with-Ubuntu-12.04-precise
                cwd: /home/dev/vminstaller
               path:
                     /usr/bin
                     /home/cr3/lib/python
                     /usr/lib/python2.7
                     /usr/lib/python2.7/plat-linux2
                     /usr/lib/python2.7/lib-tk
                     /usr/lib/python2.7/lib-old
                     /usr/lib/python2.7/lib-dynload
                     /usr/local/lib/python2.7/dist-packages
                     /usr/lib/python2.7/dist-packages
                     /usr/lib/python2.7/dist-packages/PIL
                     /usr/lib/python2.7/dist-packages/gst-0.10
                     /usr/lib/python2.7/dist-packages/gtk-2.0
                     /usr/lib/pymodules/python2.7
                     /usr/lib/python2.7/dist-packages/ubuntu-sso-client
                     /usr/lib/python2.7/dist-packages/ubuntuone-client
                     /usr/lib/python2.7/dist-packages/ubuntuone-control-panel
                     /usr/lib/python2.7/dist-packages/ubuntuone-couch
                     /usr/lib/python2.7/dist-packages/ubuntuone-installer
                     /usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol
        environment:
                     PYTHONPATH = /home/cr3/lib/python
    

    And here's the coverage report:

    /usr/share/pyshared/coverage/collector         132    127     4%   3-229, 236-244, 248-292
    /usr/share/pyshared/coverage/control           236    235     1%   3-355, 358-624
    /usr/share/pyshared/coverage/execfile           35     14    60%   3-17, 42-43, 48, 58-65
    test                                            33      6    82%   21-24, 27, 48
    vminstaller/__init__                             2      0   100%
    vminstaller/command                             12      7    42%   17-24
    vminstaller/disk                                80      0   100%
    vminstaller/initrd                              70     12    83%   102-119, 128, 135, 147, 154
    vminstaller/iso/__init__                         0      0   100%
    vminstaller/iso/inode                          157      3    98%   110, 161, 202
    vminstaller/iso/tests/__init__                   0      0   100%
    vminstaller/iso/tests/test_inode               228      0   100%
    vminstaller/monitor                             27      0   100%
    vminstaller/scripts/__init__                     0      0   100%
    vminstaller/scripts/application                 39      0   100%
    vminstaller/scripts/logger                      52     16    69%   33-44, 48-59, 71-72, 89
    vminstaller/scripts/tests/__init__               0      0   100%
    vminstaller/scripts/tests/test_application      82      0   100%
    vminstaller/scripts/tests/test_logger           37      0   100%
    vminstaller/testing/__init__                     0      0   100%
    vminstaller/testing/temp                        54      0   100%
    vminstaller/testing/tests/__init__               0      0   100%
    vminstaller/testing/tests/test_temp             81      0   100%
    vminstaller/testing/tests/test_unique           21      0   100%
    vminstaller/testing/unique                      19      0   100%
    vminstaller/tests/__init__                      25      4    84%   37-41
    vminstaller/tests/test_disk                    147      0   100%
    vminstaller/tests/test_initrd                   71      0   100%
    vminstaller/tests/test_monitor                  68      0   100%
    --------------------------------------------------------------------------
    TOTAL                                    
    

    veloutin reports that the files in /...2.7/dist-packages/ are symlinks to those in /..pyshared/

  3. Log in to comment