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.core |
|
5 | from IPython.core import ipapi | |
6 |
|
6 | |||
7 | import astyle, ipipe |
|
7 | import astyle, ipipe | |
8 |
|
8 |
@@ -56,55 +56,60 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 | # 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 | # 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 |
|
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 |
|
201 | nose_packages = ['config', 'core', 'extensions', | |
226 | top_pack = ['config','extensions','frontend', |
|
202 | 'frontend', 'lib', 'quarantine', | |
227 |
'testing',' |
|
203 | 'scripts', 'testing', 'utils'] | |
|
204 | trial_packages = ['kernel'] | |||
228 |
|
205 | |||
229 | if have_wx: |
|
206 | if have_wx: | |
230 |
|
|
207 | nose_packages.append('gui') | |
231 |
|
208 | |||
232 |
|
|
209 | nose_packages = ['IPython.%s' % m for m in nose_packages ] | |
233 |
packages = ['IPython.%s' % m for m in t |
|
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,13 +229,15 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() | |
259 | for name,runner in runners.iteritems(): |
|
238 | for name,runner in runners.iteritems(): | |
260 | print '*'*77 |
|
239 | print '*'*77 | |
261 | print 'IPython test set:',name |
|
240 | print 'IPython test set:', name | |
262 | res = runner.run() |
|
241 | res = runner.run() | |
263 | if res: |
|
242 | if res: | |
264 | failed[name] = res |
|
243 | failed[name] = res |
@@ -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 extract |
|
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