[Numpy-discussion] [numpy.testing] re-import when using coverage

josef.pktd at gmail.com josef.pktd at gmail.com
Wed May 16 12:44:41 EDT 2012

On Wed, May 16, 2012 at 11:05 AM, Fabrice Silva <silva at lma.cnrs-mrs.fr> wrote:
> Hi,
> I am getting into troubles when using numpy.testing with coverage. A
> minimal example package is atached to this email. Unpack and run:
> $ python -c "import mypackage; mypackage.test(verbose=10,coverage=False)"
> $ python -c "import mypackage; mypackage.test(verbose=10,coverage=True)"
> Some explanations:
> This package contains two module files, one of them (b.py) defining a
> class (mycls), the other one (a.py) importing the first module. I then
> add a simple test file, that does instantiate the class through the
> other module (a.py) and checking the type of the resulting object
> against b.mycls
> Without coverage, everything is ok. With coverage, I got a
> (unexpected ?) reload of the modules, leading to a mismatch of types...
> The real case is somewhat more complicated, and I would prefer to keep
> the instantiation through a.py. Is there a way to solve the problem ?

maybe it's this

It helped in my case, and I don't have a problem running the tests
with your mypackage (using my patched numpy)


> Best regards
> --
> Fabrice Silva <silva at lma.cnrs-mrs.fr>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

More information about the NumPy-Discussion mailing list