[NumPy-Tickets] [NumPy] #2153: Production code is importing numpy testcases

NumPy Trac numpy-tickets@scipy....
Wed Jun 6 12:14:57 CDT 2012


#2153: Production code is importing numpy testcases
-------------------------+--------------------------------------------------
 Reporter:  ms4py        |       Owner:  somebody   
     Type:  enhancement  |      Status:  new        
 Priority:  normal       |   Milestone:  Unscheduled
Component:  Other        |     Version:  1.6.1      
 Keywords:               |  
-------------------------+--------------------------------------------------
 Numpy is importing its testcases on a default import, this is a very bad
 style. See as reference:


 {{{
 >>> class A:
 ...   pass
 ...
 >>> sys.modules['unittest'] = A
 >>> import numpy
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/local/Cellar/python/2.7.3/lib/python2.7/site-
 packages/numpy/__init__.py", line 137, in <module>
     import add_newdocs
   File "/usr/local/Cellar/python/2.7.3/lib/python2.7/site-
 packages/numpy/add_newdocs.py", line 9, in <module>
     from numpy.lib import add_newdoc
   File "/usr/local/Cellar/python/2.7.3/lib/python2.7/site-
 packages/numpy/lib/__init__.py", line 4, in <module>
     from type_check import *
   File "/usr/local/Cellar/python/2.7.3/lib/python2.7/site-
 packages/numpy/lib/type_check.py", line 8, in <module>
     import numpy.core.numeric as _nx
   File "/usr/local/Cellar/python/2.7.3/lib/python2.7/site-
 packages/numpy/core/__init__.py", line 40, in <module>
     from numpy.testing import Tester
   File "/usr/local/Cellar/python/2.7.3/lib/python2.7/site-
 packages/numpy/testing/__init__.py", line 8, in <module>
     from unittest import TestCase
 ImportError: cannot import name TestCase
 }}}

 (I know how to solve this Exception, that is not the point)

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/2153>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list