[TIP] coverage.py with Py2 and Py3

Éric Araujo merwok at netwok.org
Fri Apr 15 08:20:59 PDT 2011


 Hi,

>   How can I install coverage.py for use in both Py2 and Py3?  I
> installed coverage.py for Py2, but it looks like installing it in 
> Py3,
> also, will overwrite the script launcher to use Py3.  Is there a way
> to use coverage.py in both, serially?

 Scripts shipped with Python itself are named “thing” in 2.x and 
 “thing3”
 in 3.x.  There is no support in distutils to do that for your own
 projects, but it would not be hard to write a build_

 coverage could also be improved to bu runnable as a module:

   $ python2.7 -m coverage
   $ python3.2 -m coverage

 This is easily implemented (add a __main__ block at the end of the
 coverage module, or add a __main__ module if coverage is a package) and
 bypasses the issue of scripts overriding or versioning.

 Regards



More information about the testing-in-python mailing list