[TIP] coverage.py with Py2 and Py3

Ned Batchelder ned at nedbatchelder.com
Fri Apr 15 09:18:33 PDT 2011


On 4/15/2011 11:20 AM, Éric Araujo wrote:
> 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.
>
The latest released version of coverage.py (3.4) includes this, though I 
notice now that it isn't mentioned in the CHANGES file.

--Ned.

> Regards
>
> _______________________________________________
> 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