Test machinery is imported at normal runtime #446

Closed
fperez opened this Issue May 17, 2011 · 4 comments

2 participants

@fperez
IPython member

By hitting Ctrl-C randomly, I managed to see this traceback while starting the html notebook:

(codemirror)longs[notebook]> python notebook.py 
^CTraceback (most recent call last):
  File "notebook.py", line 22, in 
    from kernelmanager import KernelManager
  File "/home/fperez/ipython/ipython/IPython/frontend/html/notebook/kernelmanager.py", line 5, in 
    from IPython.zmq.ipkernel import launch_kernel
  File "/home/fperez/usr/lib/python2.6/site-packages/IPython/__init__.py", line 47, in 
    from .frontend.terminal.embed import embed
  File "/home/fperez/usr/lib/python2.6/site-packages/IPython/frontend/terminal/embed.py", line 33, in 
    from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell
  File "/home/fperez/usr/lib/python2.6/site-packages/IPython/frontend/terminal/interactiveshell.py", line 26, in 
    from IPython.core.interactiveshell import InteractiveShell, InteractiveShellABC
  File "/home/fperez/usr/lib/python2.6/site-packages/IPython/core/interactiveshell.py", line 36, in 
    from IPython.core import history as ipcorehist
  File "/home/fperez/usr/lib/python2.6/site-packages/IPython/core/history.py", line 27, in 
    from IPython.testing import decorators as testdec
  File "/home/fperez/usr/lib/python2.6/site-packages/IPython/testing/decorators.py", line 321, in 
    skipif_not_sympy = skipif(module_not_available('sympy'),"This test requires sympy")
  File "/home/fperez/usr/lib/python2.6/site-packages/IPython/testing/decorators.py", line 285, in module_not_available
    mod = __import__(module)
  File "/usr/lib/pymodules/python2.6/sympy/__init__.py", line 24, in 
    from polys import *
  File "/usr/lib/pymodules/python2.6/sympy/polys/__init__.py", line 1, in 
    from monomial import monomials, monomial_count
KeyboardInterrupt
(codemirror)longs[notebook]> python notebook.py 

It shows our test decorators are getting pulled in at runtime, and some of them will try to import a lot of things we don't necessarily want always (numpy, sympy, etc). We should ensure they only get used in this manner when actually running the tests, but otherwise don't get pulled in, since that adds startup overhead and could potentially cause problems if too many modules get imported simultaneously that don't like to coexist (similar to the crashes pydoc often causes).

@takluyver
IPython member

skip_doctest() is what's being used. I think we can just split it out into a separate file. I'll work on this shortly, unless anyone beats me to it.

@fperez
IPython member

Go for it, today I have some time for ipython but will try to punch on the config stuff with Brian and Min, so I won't get to it. Config is perhaps the last big thing holding the 0.11 release back.

Thanks!

@takluyver takluyver was assigned May 17, 2011
@takluyver
IPython member

Closed by commit dd8c6b4

@takluyver takluyver closed this May 18, 2011
@fperez
IPython member

Thanks much, @takluyver!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment