Merging upstream changes.

This commit is contained in:
Brian Granger 2009-07-28 09:33:37 -07:00
commit a76420c74e

View File

@ -55,56 +55,68 @@ have_twisted = test_for('twisted')
have_foolscap = test_for('foolscap')
have_objc = test_for('objc')
have_pexpect = test_for('pexpect')
have_gtk = test_for('gtk')
have_gobject = test_for('gobject')
# 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', 'clearcmd'),
pjoin('IPython', 'extensions', 'PhysicalQInteractive'),
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'))
def make_exclude():
if not have_objc:
EXCLUDE.append(pjoin('IPython', 'frontend', 'cocoa'))
# 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', 'clearcmd'),
pjoin('IPython', 'extensions', 'PhysicalQInteractive'),
pjoin('IPython', 'extensions', 'scitedirector'),
pjoin('IPython', 'extensions', 'numeric_formats'),
pjoin('IPython', 'testing', 'attic'),
pjoin('IPython', 'testing', 'tools'),
pjoin('IPython', 'testing', 'mkdoctests'),
pjoin('IPython', 'lib', 'inputhook')
]
if not have_curses:
EXCLUDE.append(pjoin('IPython', 'extensions', 'ibrowse'))
if not have_wx:
EXCLUDE.append(pjoin('IPython', 'extensions', 'igrid'))
EXCLUDE.append(pjoin('IPython', 'gui'))
EXCLUDE.append(pjoin('IPython', 'frontend', 'wx'))
EXCLUDE.append(pjoin('IPython', 'lib', 'inputhookwx'))
if not sys.platform == 'win32':
EXCLUDE.append(pjoin('IPython', 'platutils_win32'))
if not have_gtk or not have_gobject:
EXCLUDE.append(pjoin('IPython', 'lib', 'inputhookgtk'))
# 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 have_objc:
EXCLUDE.append(pjoin('IPython', 'frontend', 'cocoa'))
if not os.name == 'posix':
EXCLUDE.append(pjoin('IPython', 'platutils_posix'))
if not have_curses:
EXCLUDE.append(pjoin('IPython', 'extensions', 'ibrowse'))
if not have_pexpect:
EXCLUDE.append(pjoin('IPython', 'lib', 'irunner'))
if not sys.platform == 'win32':
EXCLUDE.append(pjoin('IPython', 'utils', 'platutils_win32'))
# 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]
# 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'))
# 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
#-----------------------------------------------------------------------------
# Functions and classes
@ -155,13 +167,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)
@ -191,55 +202,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 = \
['backgroundjobs.py', 'coloransi.py', 'completer.py', 'configloader.py',
'crashhandler.py', 'debugger.py', 'deepreload.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', 'twshell.py',
'ultratb.py', 'upgradedir.py', 'usage.py', 'wildcard.py',
# See note above for why this is skipped
# 'shell.py',
'winconsole.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 top_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=modules)
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
@ -252,13 +236,15 @@ 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()
for name,runner in runners.iteritems():
print '*'*77
print 'IPython test set:',name
print 'IPython test set:', name
res = runner.run()
if res:
failed[name] = res