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

Fabrice Silva silva at lma.cnrs-mrs.fr
Wed May 16 13:01:47 EDT 2012


> 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...

> 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




More information about the NumPy-Discussion mailing list