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