##// END OF EJS Templates
Refactored iptest.py to work with new package org....
Brian Granger -
Show More
@@ -2,7 +2,7 b''
2
2
3 import curses, fcntl, signal, struct, tty, textwrap, inspect
3 import curses, fcntl, signal, struct, tty, textwrap, inspect
4
4
5 from IPython.coreZ import ipapi
5 from IPython.core import ipapi
6
6
7 import astyle, ipipe
7 import astyle, ipipe
8
8
@@ -56,6 +56,9 b" have_foolscap = test_for('foolscap')"
56 have_objc = test_for('objc')
56 have_objc = test_for('objc')
57 have_pexpect = test_for('pexpect')
57 have_pexpect = test_for('pexpect')
58
58
59
60 def make_exclude():
61
59 # For the IPythonDoctest plugin, we need to exclude certain patterns that cause
62 # For the IPythonDoctest plugin, we need to exclude certain patterns that cause
60 # testing problems. We should strive to minimize the number of skipped
63 # testing problems. We should strive to minimize the number of skipped
61 # modules, since this means untested code. As the testing machinery
64 # modules, since this means untested code. As the testing machinery
@@ -63,14 +66,12 b" have_pexpect = test_for('pexpect')"
63 EXCLUDE = [pjoin('IPython', 'external'),
66 EXCLUDE = [pjoin('IPython', 'external'),
64 pjoin('IPython', 'frontend', 'process', 'winprocess.py'),
67 pjoin('IPython', 'frontend', 'process', 'winprocess.py'),
65 pjoin('IPython_doctest_plugin'),
68 pjoin('IPython_doctest_plugin'),
66 pjoin('IPython', 'Gnuplot'),
67 pjoin('IPython', 'extensions', 'ipy_'),
69 pjoin('IPython', 'extensions', 'ipy_'),
68 pjoin('IPython', 'extensions', 'clearcmd'),
70 pjoin('IPython', 'extensions', 'clearcmd'),
69 pjoin('IPython', 'extensions', 'PhysicalQInteractive'),
71 pjoin('IPython', 'extensions', 'PhysicalQInteractive'),
70 pjoin('IPython', 'extensions', 'scitedirector'),
72 pjoin('IPython', 'extensions', 'scitedirector'),
71 pjoin('IPython', 'extensions', 'numeric_formats'),
73 pjoin('IPython', 'extensions', 'numeric_formats'),
72 pjoin('IPython', 'testing', 'attic'),
74 pjoin('IPython', 'testing', 'attic'),
73 pjoin('IPython', 'testing', 'tutils'),
74 pjoin('IPython', 'testing', 'tools'),
75 pjoin('IPython', 'testing', 'tools'),
75 pjoin('IPython', 'testing', 'mkdoctests')
76 pjoin('IPython', 'testing', 'mkdoctests')
76 ]
77 ]
@@ -87,7 +88,7 b' if not have_curses:'
87 EXCLUDE.append(pjoin('IPython', 'extensions', 'ibrowse'))
88 EXCLUDE.append(pjoin('IPython', 'extensions', 'ibrowse'))
88
89
89 if not sys.platform == 'win32':
90 if not sys.platform == 'win32':
90 EXCLUDE.append(pjoin('IPython', 'platutils_win32'))
91 EXCLUDE.append(pjoin('IPython', 'utils', 'platutils_win32'))
91
92
92 # These have to be skipped on win32 because the use echo, rm, cd, etc.
93 # These have to be skipped on win32 because the use echo, rm, cd, etc.
93 # See ticket https://bugs.launchpad.net/bugs/366982
94 # See ticket https://bugs.launchpad.net/bugs/366982
@@ -96,15 +97,19 b" if sys.platform == 'win32':"
96 EXCLUDE.append(pjoin('IPython', 'testing', 'plugin', 'dtexample'))
97 EXCLUDE.append(pjoin('IPython', 'testing', 'plugin', 'dtexample'))
97
98
98 if not os.name == 'posix':
99 if not os.name == 'posix':
99 EXCLUDE.append(pjoin('IPython', 'platutils_posix'))
100 EXCLUDE.append(pjoin('IPython', 'utils', 'platutils_posix'))
100
101
101 if not have_pexpect:
102 if not have_pexpect:
102 EXCLUDE.append(pjoin('IPython', 'lib', 'irunner'))
103 EXCLUDE.append(pjoin('IPython', 'scripts', 'irunner'))
104
105 # Skip shell always because of a bug in FakeModule.
106 EXCLUDE.append(pjoin('IPython', 'core', 'shell'))
103
107
104 # This is needed for the reg-exp to match on win32 in the ipdoctest plugin.
108 # This is needed for the reg-exp to match on win32 in the ipdoctest plugin.
105 if sys.platform == 'win32':
109 if sys.platform == 'win32':
106 EXCLUDE = [s.replace('\\','\\\\') for s in EXCLUDE]
110 EXCLUDE = [s.replace('\\','\\\\') for s in EXCLUDE]
107
111
112 return EXCLUDE
108
113
109 #-----------------------------------------------------------------------------
114 #-----------------------------------------------------------------------------
110 # Functions and classes
115 # Functions and classes
@@ -155,13 +160,12 b' def run_iptest():'
155
160
156 # Construct list of plugins, omitting the existing doctest plugin, which
161 # Construct list of plugins, omitting the existing doctest plugin, which
157 # ours replaces (and extends).
162 # ours replaces (and extends).
163 EXCLUDE = make_exclude()
158 plugins = [IPythonDoctest(EXCLUDE)]
164 plugins = [IPythonDoctest(EXCLUDE)]
159 for p in nose.plugins.builtin.plugins:
165 for p in nose.plugins.builtin.plugins:
160 plug = p()
166 plug = p()
161 if plug.name == 'doctest':
167 if plug.name == 'doctest':
162 continue
168 continue
163
164 #print '*** adding plugin:',plug.name # dbg
165 plugins.append(plug)
169 plugins.append(plug)
166
170
167 TestProgram(argv=argv,plugins=plugins)
171 TestProgram(argv=argv,plugins=plugins)
@@ -191,55 +195,28 b' class IPTester(object):'
191
195
192
196
193 def make_runners():
197 def make_runners():
194 """Define the modules and packages that need to be tested.
198 """Define the top-level packages that need to be tested.
195 """
199 """
196
200
197 # This omits additional top-level modules that should not be doctested.
201 nose_packages = ['config', 'core', 'extensions',
198 # XXX: shell.py is also ommited because of a bug in the skip_doctest
202 'frontend', 'lib', 'quarantine',
199 # decorator. See ticket https://bugs.launchpad.net/bugs/366209
203 'scripts', 'testing', 'utils']
200 top_mod = \
204 trial_packages = ['kernel']
201 ['backgroundjobs.py', 'coloransi.py', 'completer.py', 'configloader.py',
202 'crashhandler.py', 'debugger.py', 'deepreload.py', 'demo.py',
203 'DPyGetOpt.py', 'dtutils.py', 'excolors.py', 'fakemodule.py',
204 'generics.py', 'genutils.py', 'history.py', 'hooks.py', 'ipapi.py',
205 'iplib.py', 'ipmaker.py', 'ipstruct.py', 'Itpl.py',
206 'logger.py', 'macro.py', 'magic.py', 'oinspect.py',
207 'outputtrap.py', 'platutils.py', 'prefilter.py', 'prompts.py',
208 'PyColorize.py', 'release.py', 'rlineimpl.py', 'shadowns.py',
209 'shellglobals.py', 'strdispatch.py', 'twshell.py',
210 'ultratb.py', 'upgradedir.py', 'usage.py', 'wildcard.py',
211 # See note above for why this is skipped
212 # 'shell.py',
213 'winconsole.py']
214
215 if have_pexpect:
216 top_mod.append('irunner.py')
217
218 if sys.platform == 'win32':
219 top_mod.append('platutils_win32.py')
220 elif os.name == 'posix':
221 top_mod.append('platutils_posix.py')
222 else:
223 top_mod.append('platutils_dummy.py')
224
225 # These are tested by nose, so skip IPython.kernel
226 top_pack = ['config','extensions','frontend',
227 'testing','tests','tools','userconfig']
228
205
229 if have_wx:
206 if have_wx:
230 top_pack.append('gui')
207 nose_packages.append('gui')
231
208
232 modules = ['IPython.%s' % m[:-3] for m in top_mod ]
209 nose_packages = ['IPython.%s' % m for m in nose_packages ]
233 packages = ['IPython.%s' % m for m in top_pack ]
210 trial_packages = ['IPython.%s' % m for m in trial_packages ]
234
211
235 # Make runners
212 # Make runners
236 runners = dict(zip(top_pack, [IPTester(params=v) for v in packages]))
213 runners = dict()
237
214
238 # Test IPython.kernel using trial if twisted is installed
215 nose_runners = dict(zip(nose_packages, [IPTester(params=v) for v in nose_packages]))
239 if have_zi and have_twisted and have_foolscap:
216 if have_zi and have_twisted and have_foolscap:
240 runners['trial'] = IPTester('trial',['IPython'])
217 trial_runners = dict(zip(trial_packages, [IPTester('trial',params=v) for v in trial_packages]))
241
218 runners.update(nose_runners)
242 runners['modules'] = IPTester(params=modules)
219 runners.update(trial_runners)
243
220
244 return runners
221 return runners
245
222
@@ -252,7 +229,9 b' def run_iptestall():'
252 and packages of IPython to be tested each in their own subprocess using
229 and packages of IPython to be tested each in their own subprocess using
253 nose or twisted.trial appropriately.
230 nose or twisted.trial appropriately.
254 """
231 """
232
255 runners = make_runners()
233 runners = make_runners()
234
256 # Run all test runners, tracking execution time
235 # Run all test runners, tracking execution time
257 failed = {}
236 failed = {}
258 t_start = time.time()
237 t_start = time.time()
@@ -2178,7 +2178,7 b' def extract_vars(*names,**kw):'
2178
2178
2179 In [2]: def func(x):
2179 In [2]: def func(x):
2180 ...: y = 1
2180 ...: y = 1
2181 ...: print extractVars('x','y')
2181 ...: print extract_vars('x','y')
2182 ...:
2182 ...:
2183
2183
2184 In [3]: func('hello')
2184 In [3]: func('hello')
General Comments 0
You need to be logged in to leave comments. Login now