##// 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 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 7 import astyle, ipipe
8 8
@@ -56,55 +56,60 b" have_foolscap = test_for('foolscap')"
56 56 have_objc = test_for('objc')
57 57 have_pexpect = test_for('pexpect')
58 58
59 # For the IPythonDoctest plugin, we need to exclude certain patterns that cause
60 # testing problems. We should strive to minimize the number of skipped
61 # modules, since this means untested code. As the testing machinery
62 # solidifies, this list should eventually become empty.
63 EXCLUDE = [pjoin('IPython', 'external'),
64 pjoin('IPython', 'frontend', 'process', 'winprocess.py'),
65 pjoin('IPython_doctest_plugin'),
66 pjoin('IPython', 'Gnuplot'),
67 pjoin('IPython', 'extensions', 'ipy_'),
68 pjoin('IPython', 'extensions', 'clearcmd'),
69 pjoin('IPython', 'extensions', 'PhysicalQInteractive'),
70 pjoin('IPython', 'extensions', 'scitedirector'),
71 pjoin('IPython', 'extensions', 'numeric_formats'),
72 pjoin('IPython', 'testing', 'attic'),
73 pjoin('IPython', 'testing', 'tutils'),
74 pjoin('IPython', 'testing', 'tools'),
75 pjoin('IPython', 'testing', 'mkdoctests')
76 ]
77
78 if not have_wx:
79 EXCLUDE.append(pjoin('IPython', 'extensions', 'igrid'))
80 EXCLUDE.append(pjoin('IPython', 'gui'))
81 EXCLUDE.append(pjoin('IPython', 'frontend', 'wx'))
82
83 if not have_objc:
84 EXCLUDE.append(pjoin('IPython', 'frontend', 'cocoa'))
85
86 if not have_curses:
87 EXCLUDE.append(pjoin('IPython', 'extensions', 'ibrowse'))
88
89 if not sys.platform == 'win32':
90 EXCLUDE.append(pjoin('IPython', 'platutils_win32'))
91
92 # These have to be skipped on win32 because the use echo, rm, cd, etc.
93 # See ticket https://bugs.launchpad.net/bugs/366982
94 if sys.platform == 'win32':
95 EXCLUDE.append(pjoin('IPython', 'testing', 'plugin', 'test_exampleip'))
96 EXCLUDE.append(pjoin('IPython', 'testing', 'plugin', 'dtexample'))
97
98 if not os.name == 'posix':
99 EXCLUDE.append(pjoin('IPython', 'platutils_posix'))
100
101 if not have_pexpect:
102 EXCLUDE.append(pjoin('IPython', 'lib', 'irunner'))
103
104 # This is needed for the reg-exp to match on win32 in the ipdoctest plugin.
105 if sys.platform == 'win32':
106 EXCLUDE = [s.replace('\\','\\\\') for s in EXCLUDE]
107 59
60 def make_exclude():
61
62 # For the IPythonDoctest plugin, we need to exclude certain patterns that cause
63 # testing problems. We should strive to minimize the number of skipped
64 # modules, since this means untested code. As the testing machinery
65 # solidifies, this list should eventually become empty.
66 EXCLUDE = [pjoin('IPython', 'external'),
67 pjoin('IPython', 'frontend', 'process', 'winprocess.py'),
68 pjoin('IPython_doctest_plugin'),
69 pjoin('IPython', 'extensions', 'ipy_'),
70 pjoin('IPython', 'extensions', 'clearcmd'),
71 pjoin('IPython', 'extensions', 'PhysicalQInteractive'),
72 pjoin('IPython', 'extensions', 'scitedirector'),
73 pjoin('IPython', 'extensions', 'numeric_formats'),
74 pjoin('IPython', 'testing', 'attic'),
75 pjoin('IPython', 'testing', 'tools'),
76 pjoin('IPython', 'testing', 'mkdoctests')
77 ]
78
79 if not have_wx:
80 EXCLUDE.append(pjoin('IPython', 'extensions', 'igrid'))
81 EXCLUDE.append(pjoin('IPython', 'gui'))
82 EXCLUDE.append(pjoin('IPython', 'frontend', 'wx'))
83
84 if not have_objc:
85 EXCLUDE.append(pjoin('IPython', 'frontend', 'cocoa'))
86
87 if not have_curses:
88 EXCLUDE.append(pjoin('IPython', 'extensions', 'ibrowse'))
89
90 if not sys.platform == 'win32':
91 EXCLUDE.append(pjoin('IPython', 'utils', 'platutils_win32'))
92
93 # These have to be skipped on win32 because the use echo, rm, cd, etc.
94 # See ticket https://bugs.launchpad.net/bugs/366982
95 if sys.platform == 'win32':
96 EXCLUDE.append(pjoin('IPython', 'testing', 'plugin', 'test_exampleip'))
97 EXCLUDE.append(pjoin('IPython', 'testing', 'plugin', 'dtexample'))
98
99 if not os.name == 'posix':
100 EXCLUDE.append(pjoin('IPython', 'utils', 'platutils_posix'))
101
102 if not have_pexpect:
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'))
107
108 # This is needed for the reg-exp to match on win32 in the ipdoctest plugin.
109 if sys.platform == 'win32':
110 EXCLUDE = [s.replace('\\','\\\\') for s in EXCLUDE]
111
112 return EXCLUDE
108 113
109 114 #-----------------------------------------------------------------------------
110 115 # Functions and classes
@@ -155,13 +160,12 b' def run_iptest():'
155 160
156 161 # Construct list of plugins, omitting the existing doctest plugin, which
157 162 # ours replaces (and extends).
163 EXCLUDE = make_exclude()
158 164 plugins = [IPythonDoctest(EXCLUDE)]
159 165 for p in nose.plugins.builtin.plugins:
160 166 plug = p()
161 167 if plug.name == 'doctest':
162 168 continue
163
164 #print '*** adding plugin:',plug.name # dbg
165 169 plugins.append(plug)
166 170
167 171 TestProgram(argv=argv,plugins=plugins)
@@ -191,55 +195,28 b' class IPTester(object):'
191 195
192 196
193 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
197 # This omits additional top-level modules that should not be doctested.
198 # XXX: shell.py is also ommited because of a bug in the skip_doctest
199 # decorator. See ticket https://bugs.launchpad.net/bugs/366209
200 top_mod = \
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 200
225 # These are tested by nose, so skip IPython.kernel
226 top_pack = ['config','extensions','frontend',
227 'testing','tests','tools','userconfig']
201 nose_packages = ['config', 'core', 'extensions',
202 'frontend', 'lib', 'quarantine',
203 'scripts', 'testing', 'utils']
204 trial_packages = ['kernel']
228 205
229 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 ]
233 packages = ['IPython.%s' % m for m in top_pack ]
209 nose_packages = ['IPython.%s' % m for m in nose_packages ]
210 trial_packages = ['IPython.%s' % m for m in trial_packages ]
234 211
235 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 216 if have_zi and have_twisted and have_foolscap:
240 runners['trial'] = IPTester('trial',['IPython'])
241
242 runners['modules'] = IPTester(params=modules)
217 trial_runners = dict(zip(trial_packages, [IPTester('trial',params=v) for v in trial_packages]))
218 runners.update(nose_runners)
219 runners.update(trial_runners)
243 220
244 221 return runners
245 222
@@ -252,13 +229,15 b' def run_iptestall():'
252 229 and packages of IPython to be tested each in their own subprocess using
253 230 nose or twisted.trial appropriately.
254 231 """
232
255 233 runners = make_runners()
234
256 235 # Run all test runners, tracking execution time
257 236 failed = {}
258 237 t_start = time.time()
259 238 for name,runner in runners.iteritems():
260 239 print '*'*77
261 print 'IPython test set:',name
240 print 'IPython test set:', name
262 241 res = runner.run()
263 242 if res:
264 243 failed[name] = res
@@ -2178,7 +2178,7 b' def extract_vars(*names,**kw):'
2178 2178
2179 2179 In [2]: def func(x):
2180 2180 ...: y = 1
2181 ...: print extractVars('x','y')
2181 ...: print extract_vars('x','y')
2182 2182 ...:
2183 2183
2184 2184 In [3]: func('hello')
General Comments 0
You need to be logged in to leave comments. Login now