Error running python coverage

2010-08-26
2013-03-15
  • Chad Kennedy
    Chad Kennedy
    2010-08-26

    When I select Run - Run As - Python Coverage the following message appears in the Console window:

      File "C:\eclipse\plugins\org.python.pydev.debug_1.6.1.2010080312\pysrc\coverage.py", line 336
        print error
                  ^
    SyntaxError: invalid syntax

    My configuration:
    Windows Vista
    Python 3.1.2
    Eclipse 3.6

    I see that the file coverage.py is using Python 2.x-style print statements, which won't work with Python 3.1.2.  My question is, what is the right way to fix this?  I spent a while googling for answers and couldn't find anything relevant. 

    Looking here: http://nedbatchelder.com/code/coverage/ I noticed that coverage.py is on version 3.3.1 and supports Python 3.  I was going to replace the one installed with pydev (at version 2.78.20070930).  However, the coverage.py 3.3.1 archive doesn't even contain a coverage.py file.

    Thanks for any insights!

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2010-08-26

    Please report this as a bug. I'll update the coverage version in pydev then (there's a patch I need to apply so that it works in pydev).

    Cheers,

    Fabio

     
  • D Mytty
    D Mytty
    2011-03-05

    This still has not been fixed…

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2011-03-13

    Working on that (should be fixed for 1.6.6).

    Cheers,

    Fabio

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2011-03-16

    Hi, ok, this is now done for 1.6.6. Also, there were major changes in the coverage as a whole, so, if someone could get the latest nightly (that already has those changes) and give me feedback on it before the final release (so that any problems can still be fixed), that'd be nice.

    Cheers,

    Fabio

     
  • c_plus_plus
    c_plus_plus
    2011-03-24

    I got the nightly build, and there is no longer a run configuration for coverage.

     
  • c_plus_plus
    c_plus_plus
    2011-03-24

    Nevermind the lack of a run configuration. I figured out how to tell it to run coverage, but when I try to use it I get the error:
    import coverage #@UnresolvedImport
    ImportError: No module named coverage

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2011-03-24

    It's no longer distributed with pydev (you have to have it installed in your python install from http://nedbatchelder.com/code/coverage/).

    Cheers,

    Fabio

     
  • c_plus_plus
    c_plus_plus
    2011-03-24

    Alright. Sorry about the triple post. This forum could use an edit feature, and I could use to check more before posing. I noticed I needed to install a third party module, and I did so. It is difficult to display the coverage results. It would be nice to have them loaded automatically. Also, showing the coverage results as red underlines is somewhat ugly. Would It be possible to display them as highlighted text or something similar?
    Thanks for making such a great plugin.