@ -31,7 +31,7 @@ import warnings
import nose . plugins . builtin
from nose . core import TestProgram
from IPython . platutils import find_cmd
from IPython . utils. platutils import find_cmd
from IPython . testing . plugin . ipdoctest import IPythonDoctest
pjoin = path . join
@ -58,75 +58,85 @@ have_foolscap = test_for('foolscap')
have_objc = test_for ( ' objc ' )
have_pexpect = test_for ( ' pexpect ' )
# For the IPythonDoctest plugin, we need to exclude certain patterns that cause
# testing problems. We should strive to minimize the number of skipped
# modules, since this means untested code. As the testing machinery
# solidifies, this list should eventually become empty.
EXCLUDE = [ pjoin ( ' IPython ' , ' external ' ) ,
pjoin ( ' IPython ' , ' frontend ' , ' process ' , ' winprocess.py ' ) ,
pjoin ( ' IPython_doctest_plugin ' ) ,
pjoin ( ' IPython ' , ' Gnuplot ' ) ,
pjoin ( ' IPython ' , ' Extensions ' , ' ipy_ ' ) ,
pjoin ( ' IPython ' , ' Extensions ' , ' PhysicalQInput ' ) ,
pjoin ( ' IPython ' , ' Extensions ' , ' PhysicalQInteractive ' ) ,
pjoin ( ' IPython ' , ' Extensions ' , ' InterpreterPasteInput ' ) ,
pjoin ( ' IPython ' , ' Extensions ' , ' scitedirector ' ) ,
pjoin ( ' IPython ' , ' Extensions ' , ' numeric_formats ' ) ,
pjoin ( ' IPython ' , ' testing ' , ' attic ' ) ,
pjoin ( ' IPython ' , ' testing ' , ' tutils ' ) ,
pjoin ( ' IPython ' , ' testing ' , ' tools ' ) ,
pjoin ( ' IPython ' , ' testing ' , ' mkdoctests ' ) ,
]
if not have_wx :
EXCLUDE . append ( pjoin ( ' IPython ' , ' Extensions ' , ' igrid ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' gui ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' wx ' ) )
if not have_wx_aui :
EXCLUDE . append ( pjoin ( ' IPython ' , ' gui ' , ' wx ' , ' wxIPython ' ) )
if not have_objc :
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' cocoa ' ) )
if not have_curses :
EXCLUDE . append ( pjoin ( ' IPython ' , ' Extensions ' , ' ibrowse ' ) )
if not sys . platform == ' win32 ' :
EXCLUDE . append ( pjoin ( ' IPython ' , ' platutils_win32 ' ) )
# These have to be skipped on win32 because the use echo, rm, cd, etc.
# See ticket https://bugs.launchpad.net/bugs/366982
if sys . platform == ' win32 ' :
EXCLUDE . append ( pjoin ( ' IPython ' , ' testing ' , ' plugin ' , ' test_exampleip ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' testing ' , ' plugin ' , ' dtexample ' ) )
if not os . name == ' posix ' :
EXCLUDE . append ( pjoin ( ' IPython ' , ' platutils_posix ' ) )
if not have_pexpect :
EXCLUDE . append ( pjoin ( ' IPython ' , ' irunner ' ) )
if not have_twisted :
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' asyncfrontendbase ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' prefilterfrontend ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' frontendbase ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' linefrontendbase ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' tests ' , ' test_linefrontend ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' tests ' , ' test_frontendbase ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' tests ' ,
' test_prefilterfrontend ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' tests ' ,
' test_asyncfrontendbase ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' kernel ' , ' error ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' testing ' , ' parametric ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' testing ' , ' util ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' testing ' , ' tests ' , ' test_decorators_trial ' ) )
# This is needed for the reg-exp to match on win32 in the ipdoctest plugin.
if sys . platform == ' win32 ' :
EXCLUDE = [ s . replace ( ' \\ ' , ' \\ \\ ' ) for s in EXCLUDE ]
def make_exclude ( ) :
# For the IPythonDoctest plugin, we need to exclude certain patterns that cause
# testing problems. We should strive to minimize the number of skipped
# modules, since this means untested code. As the testing machinery
# solidifies, this list should eventually become empty.
EXCLUDE = [ pjoin ( ' IPython ' , ' external ' ) ,
pjoin ( ' IPython ' , ' frontend ' , ' process ' , ' winprocess.py ' ) ,
pjoin ( ' IPython_doctest_plugin ' ) ,
pjoin ( ' IPython ' , ' extensions ' , ' ipy_ ' ) ,
pjoin ( ' IPython ' , ' extensions ' , ' PhysicalQInput ' ) ,
pjoin ( ' IPython ' , ' extensions ' , ' PhysicalQInteractive ' ) ,
pjoin ( ' IPython ' , ' extensions ' , ' InterpreterPasteInput ' ) ,
pjoin ( ' IPython ' , ' extensions ' , ' scitedirector ' ) ,
pjoin ( ' IPython ' , ' extensions ' , ' numeric_formats ' ) ,
pjoin ( ' IPython ' , ' testing ' , ' attic ' ) ,
pjoin ( ' IPython ' , ' testing ' , ' tools ' ) ,
pjoin ( ' IPython ' , ' testing ' , ' mkdoctests ' )
]
if not have_wx :
EXCLUDE . append ( pjoin ( ' IPython ' , ' extensions ' , ' igrid ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' gui ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' wx ' ) )
if not have_wx_aui :
EXCLUDE . append ( pjoin ( ' IPython ' , ' gui ' , ' wx ' , ' wxIPython ' ) )
if not have_objc :
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' cocoa ' ) )
if not have_curses :
EXCLUDE . append ( pjoin ( ' IPython ' , ' extensions ' , ' ibrowse ' ) )
if not sys . platform == ' win32 ' :
EXCLUDE . append ( pjoin ( ' IPython ' , ' utils ' , ' platutils_win32 ' ) )
# These have to be skipped on win32 because the use echo, rm, cd, etc.
# See ticket https://bugs.launchpad.net/bugs/366982
if sys . platform == ' win32 ' :
EXCLUDE . append ( pjoin ( ' IPython ' , ' testing ' , ' plugin ' , ' test_exampleip ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' testing ' , ' plugin ' , ' dtexample ' ) )
if not os . name == ' posix ' :
EXCLUDE . append ( pjoin ( ' IPython ' , ' utils ' , ' platutils_posix ' ) )
if not have_pexpect :
EXCLUDE . append ( pjoin ( ' IPython ' , ' scripts ' , ' irunner ' ) )
# This is scary. We still have things in frontend and testing that
# are being tested by nose that use twisted. We need to rethink
# how we are isolating dependencies in testing.
if not ( have_twisted and have_zi and have_foolscap ) :
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' asyncfrontendbase ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' prefilterfrontend ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' frontendbase ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' linefrontendbase ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' tests ' ,
' test_linefrontend ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' tests ' ,
' test_frontendbase ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' tests ' ,
' test_prefilterfrontend ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' frontend ' , ' tests ' ,
' test_asyncfrontendbase ' ) ) ,
EXCLUDE . append ( pjoin ( ' IPython ' , ' testing ' , ' parametric ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' testing ' , ' util ' ) )
EXCLUDE . append ( pjoin ( ' IPython ' , ' testing ' , ' tests ' ,
' test_decorators_trial ' ) )
# Skip shell always because of a bug in FakeModule.
EXCLUDE . append ( pjoin ( ' IPython ' , ' core ' , ' shell ' ) )
# This is needed for the reg-exp to match on win32 in the ipdoctest plugin.
if sys . platform == ' win32 ' :
EXCLUDE = [ s . replace ( ' \\ ' , ' \\ \\ ' ) for s in EXCLUDE ]
return EXCLUDE
#-----------------------------------------------------------------------------
@ -178,13 +188,12 @@ def run_iptest():
# Construct list of plugins, omitting the existing doctest plugin, which
# ours replaces (and extends).
EXCLUDE = make_exclude ( )
plugins = [ IPythonDoctest ( EXCLUDE ) ]
for p in nose . plugins . builtin . plugins :
plug = p ( )
if plug . name == ' doctest ' :
continue
#print '*** adding plugin:',plug.name # dbg
plugins . append ( plug )
TestProgram ( argv = argv , plugins = plugins )
@ -234,58 +243,28 @@ class IPTester(object):
def make_runners ( ) :
""" Define the modules and packages that need to be tested.
""" Define the top-level packages that need to be tested.
"""
# This omits additional top-level modules that should not be doctested.
# XXX: Shell.py is also ommited because of a bug in the skip_doctest
# decorator. See ticket https://bugs.launchpad.net/bugs/366209
top_mod = \
[ ' background_jobs.py ' , ' ColorANSI.py ' , ' completer.py ' , ' ConfigLoader.py ' ,
' CrashHandler.py ' , ' Debugger.py ' , ' deep_reload.py ' , ' demo.py ' ,
' DPyGetOpt.py ' , ' dtutils.py ' , ' excolors.py ' , ' FakeModule.py ' ,
' generics.py ' , ' genutils.py ' , ' history.py ' , ' hooks.py ' , ' ipapi.py ' ,
' iplib.py ' , ' ipmaker.py ' , ' ipstruct.py ' , ' Itpl.py ' ,
' Logger.py ' , ' macro.py ' , ' Magic.py ' , ' OInspect.py ' ,
' OutputTrap.py ' , ' platutils.py ' , ' prefilter.py ' , ' Prompts.py ' ,
' PyColorize.py ' , ' Release.py ' , ' rlineimpl.py ' , ' shadowns.py ' ,
' shellglobals.py ' , ' strdispatch.py ' ,
' ultraTB.py ' , ' upgrade_dir.py ' , ' usage.py ' , ' wildcard.py ' ,
# See note above for why this is skipped
# 'Shell.py',
' winconsole.py ' ]
if have_twisted :
top_mod . append ( ' twshell.py ' )
if have_pexpect :
top_mod . append ( ' irunner.py ' )
if sys . platform == ' win32 ' :
top_mod . append ( ' platutils_win32.py ' )
elif os . name == ' posix ' :
top_mod . append ( ' platutils_posix.py ' )
else :
top_mod . append ( ' platutils_dummy.py ' )
# These are tested by nose, so skip IPython.kernel
top_pack = [ ' config ' , ' Extensions ' , ' frontend ' ,
' testing ' , ' tests ' , ' tools ' , ' UserConfig ' ]
nose_packages = [ ' config ' , ' core ' , ' extensions ' ,
' frontend ' , ' lib ' , ' quarantine ' ,
' scripts ' , ' testing ' , ' utils ' ]
trial_packages = [ ' kernel ' ]
if have_wx :
top_pack . append ( ' gui ' )
nose_packages . append ( ' gui ' )
modules = [ ' IPython. %s ' % m [ : - 3 ] for m in top_mod ]
packages = [ ' IPython. %s ' % m for m in t op_pack ]
nose_packages = [ ' IPython. %s ' % m for m in nose_packages ]
trial_packages = [ ' IPython. %s ' % m for m in trial_packages ]
# Make runners
runners = dict ( zip ( top_pack , [ IPTester ( params = v ) for v in packages ] ) )
runners = dict ( )
# Test IPython.kernel using trial if twisted is installed
nose_runners = dict ( zip ( nose_packages , [ IPTester ( params = v ) for v in nose_packages ] ) )
if have_zi and have_twisted and have_foolscap :
runners[ ' trial ' ] = IPTester ( ' trial ' , [ ' IPython ' ] )
runners [ ' modules ' ] = IPTester ( params = module s)
trial_runners = dict ( zip ( trial_packages , [ IPTester ( ' trial ' , params = v ) for v in trial_packages ] ) )
runners . update ( nose_runners )
runners . update ( trial_runners )
return runners
@ -298,7 +277,9 @@ def run_iptestall():
and packages of IPython to be tested each in their own subprocess using
nose or twisted . trial appropriately .
"""
runners = make_runners ( )
# Run all test runners, tracking execution time
failed = { }
t_start = time . time ( )