[Numpy-discussion] [numpy.testing] re-import when using coverage
Ralf Gommers
ralf.gommers at googlemail.com
Wed May 16 16:58:20 EDT 2012
On Wed, May 16, 2012 at 7:01 PM, Fabrice Silva <silva at lma.cnrs-mrs.fr>wrote:
> > maybe it's this
> >
> http://thread.gmane.org/gmane.comp.python.numeric.general/49785/focus=49787
> Thanks for your reply, Not sure it is the same trouble, I'll have a
> deeper look at that thread...
>
>
Both coverage=True and coverage=False work with your attached package. But
it seems you attached an old version, because test_a.py doesn't include the
actual test. "obj = a.b.mycls()" in test_a.py executes fine, so it may be a
problem with the way you wrote the test case.
Ralf
> > It helped in my case, and I don't have a problem running the tests
> > with your mypackage (using my patched numpy)
>
> What I get:
> $ python -c "import mypackage; mypackage.test(coverage=False,
> verbose=10)"
> Reading a.py file...
> Id(mycls in b) = 168022116
> Running unit tests for mypackage
> NumPy version 1.6.2rc1
> NumPy is installed in /usr/lib/pymodules/python2.7/numpy
> Python version 2.7.3rc2 (default, Apr 22 2012, 22:35:38) [GCC 4.6.3]
> nose version 1.1.2
> [...]
> test_a.test_instantition ... Id(type(self)) = 168022116
> Id(type(obj)) = 168022116
> ok
>
>
> ----------------------------------------------------------------------
> Ran 1 test in 0.002s
>
> OK
> $ python -c "import mypackage; mypackage.test(coverage=True,
> verbose=10)"
> Reading a.py file...
> Id(mycls in b) = 143573092
> Running unit tests for mypackage
> NumPy version 1.6.2rc1
> NumPy is installed in /usr/lib/pymodules/python2.7/numpy
> Python version 2.7.3rc2 (default, Apr 22 2012, 22:35:38) [GCC 4.6.3]
> nose version 1.1.2
> [...]
> Reading a.py file...
> Id(mycls in b) = 150640036
> test_a.test_instantition ...
> Id(type(self)) = 150640036
> Id(type(obj)) = 150640036
> FAIL
>
>
> ======================================================================
> FAIL: test_a.test_instantition
>
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197,
> in runTest
> self.test(*self.arg)
> File "/tmp/cover/mypackage/tests/test_a.py", line 13, in
> test_instantition
> assert a.b.is_mycls(obj)
> AssertionError
>
> [coverage results]
> Ran 1 test in 0.006s
>
> FAILED (failures=1)
>
>
>
> --
> Fabrice Silva <silva at lma.cnrs-mrs.fr>
> LMA UPR CNRS 7051
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120516/13e54969/attachment.html>
More information about the NumPy-Discussion
mailing list