##// END OF EJS Templates
Fixing bugs with the testing system.
Administrator -
Show More
@@ -36,17 +36,31 b' from IPython.testing.plugin.ipdoctest import IPythonDoctest'
36 pjoin = path.join
36 pjoin = path.join
37
37
38 #-----------------------------------------------------------------------------
38 #-----------------------------------------------------------------------------
39 # Globals and constants
39 # Logic for skipping doctests
40 #-----------------------------------------------------------------------------
40 #-----------------------------------------------------------------------------
41
41
42 def test_for(mod):
43 """Test to see if mod is importable."""
44 try:
45 __import__(mod)
46 except ImportError:
47 return False
48 else:
49 return True
50
51 have_curses = test_for('_curses')
52 have_wx = test_for('wx')
53 have_zi = test_for('zope.interface')
54 have_twisted = test_for('twisted')
55 have_foolscap = test_for('foolscap')
56 have_objc = test_for('objc')
57 have_pexpect = test_for('pexpect')
58
42 # For the IPythonDoctest plugin, we need to exclude certain patterns that cause
59 # For the IPythonDoctest plugin, we need to exclude certain patterns that cause
43 # testing problems. We should strive to minimize the number of skipped
60 # testing problems. We should strive to minimize the number of skipped
44 # modules, since this means untested code. As the testing machinery
61 # modules, since this means untested code. As the testing machinery
45 # solidifies, this list should eventually become empty.
62 # solidifies, this list should eventually become empty.
46 EXCLUDE = [pjoin('IPython', 'external'),
63 EXCLUDE = [pjoin('IPython', 'external'),
47 # This skip is duplicated below XXX
48 pjoin('IPython', 'platutils_win32'),
49 pjoin('IPython', 'frontend', 'cocoa'),
50 pjoin('IPython', 'frontend', 'process', 'winprocess.py'),
64 pjoin('IPython', 'frontend', 'process', 'winprocess.py'),
51 pjoin('IPython_doctest_plugin'),
65 pjoin('IPython_doctest_plugin'),
52 pjoin('IPython', 'Gnuplot'),
66 pjoin('IPython', 'Gnuplot'),
@@ -56,18 +70,28 b" EXCLUDE = [pjoin('IPython', 'external'),"
56 pjoin('IPython', 'Extensions', 'scitedirector'),
70 pjoin('IPython', 'Extensions', 'scitedirector'),
57 pjoin('IPython', 'Extensions', 'numeric_formats'),
71 pjoin('IPython', 'Extensions', 'numeric_formats'),
58 pjoin('IPython', 'testing', 'attic'),
72 pjoin('IPython', 'testing', 'attic'),
73 pjoin('IPython', 'testing', 'tutils')
59 ]
74 ]
60
75
61 try:
76 if not have_wx:
62 import wx
63 except ImportError:
64 EXCLUDE.append(pjoin('IPython', 'Extensions', 'igrid'))
77 EXCLUDE.append(pjoin('IPython', 'Extensions', 'igrid'))
78 EXCLUDE.append(pjoin('IPython', 'gui'))
79 EXCLUDE.append(pjoin('IPython', 'frontend', 'wx'))
80
81 if not have_objc:
82 EXCLUDE.append(pjoin('IPython', 'frontend', 'cocoa'))
65
83
66 try:
84 if not have_curses:
67 import _curses
68 except ImportError:
69 EXCLUDE.append(pjoin('IPython', 'Extensions', 'ibrowse'))
85 EXCLUDE.append(pjoin('IPython', 'Extensions', 'ibrowse'))
70
86
87 if not sys.platform == 'win32':
88 EXCLUDE.append(pjoin('IPython', 'platutils_win32'))
89
90 if not os.name == 'posix':
91 EXCLUDE.append(pjoin('IPython', 'platutils_posix'))
92
93 if not have_pexpect:
94 EXCLUDE.append(pjoin('IPython', 'irunner'))
71
95
72 # This is needed for the reg-exp to match on win32 in the ipdoctest plugin.
96 # This is needed for the reg-exp to match on win32 in the ipdoctest plugin.
73 if sys.platform == 'win32':
97 if sys.platform == 'win32':
@@ -170,7 +194,7 b' def make_runners():'
170 'CrashHandler.py', 'Debugger.py', 'deep_reload.py', 'demo.py',
194 'CrashHandler.py', 'Debugger.py', 'deep_reload.py', 'demo.py',
171 'DPyGetOpt.py', 'dtutils.py', 'excolors.py', 'FakeModule.py',
195 'DPyGetOpt.py', 'dtutils.py', 'excolors.py', 'FakeModule.py',
172 'generics.py', 'genutils.py', 'history.py', 'hooks.py', 'ipapi.py',
196 'generics.py', 'genutils.py', 'history.py', 'hooks.py', 'ipapi.py',
173 'iplib.py', 'ipmaker.py', 'ipstruct.py', 'irunner.py', 'Itpl.py',
197 'iplib.py', 'ipmaker.py', 'ipstruct.py', 'Itpl.py',
174 'Logger.py', 'macro.py', 'Magic.py', 'OInspect.py',
198 'Logger.py', 'macro.py', 'Magic.py', 'OInspect.py',
175 'OutputTrap.py', 'platutils.py', 'prefilter.py', 'Prompts.py',
199 'OutputTrap.py', 'platutils.py', 'prefilter.py', 'Prompts.py',
176 'PyColorize.py', 'Release.py', 'rlineimpl.py', 'shadowns.py',
200 'PyColorize.py', 'Release.py', 'rlineimpl.py', 'shadowns.py',
@@ -180,17 +204,16 b' def make_runners():'
180 # 'Shell.py',
204 # 'Shell.py',
181 'winconsole.py']
205 'winconsole.py']
182
206
183 if os.name == 'posix':
207 if have_pexpect:
184 top_mod.append('platutils_posix.py')
208 top_mod.append('irunner.py')
185 elif sys.platform == 'win32':
186 top_mod.append('platutils_win32.py')
187 else:
188 top_mod.append('platutils_dummy.py')
189
209
190 # These are tested by nose, so skip IPython.kernel
210 # These are tested by nose, so skip IPython.kernel
191 top_pack = ['config','Extensions','frontend','gui',
211 top_pack = ['config','Extensions','frontend',
192 'testing','tests','tools','UserConfig']
212 'testing','tests','tools','UserConfig']
193
213
214 if have_wx:
215 top_pack.append('gui')
216
194 modules = ['IPython.%s' % m[:-3] for m in top_mod ]
217 modules = ['IPython.%s' % m[:-3] for m in top_mod ]
195 packages = ['IPython.%s' % m for m in top_pack ]
218 packages = ['IPython.%s' % m for m in top_pack ]
196
219
@@ -198,13 +221,7 b' def make_runners():'
198 runners = dict(zip(top_pack, [IPTester(params=v) for v in packages]))
221 runners = dict(zip(top_pack, [IPTester(params=v) for v in packages]))
199
222
200 # Test IPython.kernel using trial if twisted is installed
223 # Test IPython.kernel using trial if twisted is installed
201 try:
224 if have_zi and have_twisted and have_foolscap:
202 import zope.interface
203 import twisted
204 import foolscap
205 except ImportError:
206 pass
207 else:
208 runners['trial'] = IPTester('trial',['IPython'])
225 runners['trial'] = IPTester('trial',['IPython'])
209
226
210 runners['modules'] = IPTester(params=modules)
227 runners['modules'] = IPTester(params=modules)
@@ -840,11 +840,11 b' class ExtensionDoctest(doctests.Doctest):'
840 Modified version that accepts extension modules as valid containers for
840 Modified version that accepts extension modules as valid containers for
841 doctests.
841 doctests.
842 """
842 """
843 #print '*** ipdoctest- wantFile:',filename # dbg
843 # print '*** ipdoctest- wantFile:',filename # dbg
844
844
845 for pat in self.exclude_patterns:
845 for pat in self.exclude_patterns:
846 if pat.search(filename):
846 if pat.search(filename):
847 #print '###>>> SKIP:',filename # dbg
847 # print '###>>> SKIP:',filename # dbg
848 return False
848 return False
849
849
850 if is_extension_module(filename):
850 if is_extension_module(filename):
General Comments 0
You need to be logged in to leave comments. Login now