##// END OF EJS Templates
Temporarily disabling the ipdoctest nose plugin....
Brian Granger -
Show More
@@ -1,92 +1,98 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """IPython Test Suite Runner.
2 """IPython Test Suite Runner.
3
3
4 This module provides a main entry point to a user script to test IPython itself
4 This module provides a main entry point to a user script to test IPython itself
5 from the command line. The main() routine can be used in a similar manner to
5 from the command line. The main() routine can be used in a similar manner to
6 the ``nosetests`` script, and it takes similar arguments, but if no arguments
6 the ``nosetests`` script, and it takes similar arguments, but if no arguments
7 are given it defaults to testing all of IPython. This should be preferred to
7 are given it defaults to testing all of IPython. This should be preferred to
8 using plain ``nosetests`` because a number of nose plugins necessary to test
8 using plain ``nosetests`` because a number of nose plugins necessary to test
9 IPython correctly are automatically configured by this code.
9 IPython correctly are automatically configured by this code.
10 """
10 """
11
11
12 #-----------------------------------------------------------------------------
12 #-----------------------------------------------------------------------------
13 # Module imports
13 # Module imports
14 #-----------------------------------------------------------------------------
14 #-----------------------------------------------------------------------------
15
15
16 # stdlib
16 # stdlib
17 import sys
17 import sys
18 import warnings
18 import warnings
19
19
20 # third-party
20 # third-party
21 import nose.plugins.builtin
21 import nose.plugins.builtin
22 from nose.core import TestProgram
22 from nose.core import TestProgram
23
23
24 # Our own imports
24 # Our own imports
25 from IPython.testing.plugin.ipdoctest import IPythonDoctest
25 from IPython.testing.plugin.ipdoctest import IPythonDoctest
26
26
27 #-----------------------------------------------------------------------------
27 #-----------------------------------------------------------------------------
28 # Constants and globals
28 # Constants and globals
29 #-----------------------------------------------------------------------------
29 #-----------------------------------------------------------------------------
30
30
31 # For the IPythonDoctest plugin, we need to exclude certain patterns that cause
31 # For the IPythonDoctest plugin, we need to exclude certain patterns that cause
32 # testing problems. We should strive to minimize the number of skipped
32 # testing problems. We should strive to minimize the number of skipped
33 # modules, since this means untested code. As the testing machinery
33 # modules, since this means untested code. As the testing machinery
34 # solidifies, this list should eventually become empty.
34 # solidifies, this list should eventually become empty.
35 EXCLUDE = ['IPython/external/',
35 EXCLUDE = ['IPython/external/',
36 'IPython/platutils_win32',
36 'IPython/platutils_win32',
37 'IPython/frontend/cocoa',
37 'IPython/frontend/cocoa',
38 'IPython_doctest_plugin',
38 'IPython_doctest_plugin',
39 'IPython/Gnuplot',
39 'IPython/Gnuplot',
40 'IPython/Extensions/ipy_',
40 'IPython/Extensions/ipy_',
41 'IPython/Extensions/clearcmd',
41 'IPython/Extensions/clearcmd',
42 'IPython/Extensions/PhysicalQIn',
42 'IPython/Extensions/PhysicalQIn',
43 'IPython/Extensions/scitedirector',
43 'IPython/Extensions/scitedirector',
44 ]
44 ]
45
45
46 #-----------------------------------------------------------------------------
46 #-----------------------------------------------------------------------------
47 # Functions and classes
47 # Functions and classes
48 #-----------------------------------------------------------------------------
48 #-----------------------------------------------------------------------------
49
49
50 def main():
50 def main():
51 """Run the IPython test suite.
51 """Run the IPython test suite.
52 """
52 """
53
53
54 warnings.filterwarnings('ignore',
54 warnings.filterwarnings('ignore',
55 'This will be removed soon. Use IPython.testing.util instead')
55 'This will be removed soon. Use IPython.testing.util instead')
56
56
57 argv = sys.argv + [ '--with-ipdoctest',
57 argv = sys.argv + [
58 # Loading ipdoctest causes problems with Twisted.
59 # I am removing this as a temporary fix to get the
60 # test suite back into working shape. Our nose
61 # plugin needs to be gone through with a fine
62 # toothed comb to find what is causing the problem.
63 # '--with-ipdoctest',
58 '--doctest-tests','--doctest-extension=txt',
64 '--doctest-tests','--doctest-extension=txt',
59 '--detailed-errors',
65 '--detailed-errors',
60
66
61 # We add --exe because of setuptools' imbecility (it
67 # We add --exe because of setuptools' imbecility (it
62 # blindly does chmod +x on ALL files). Nose does the
68 # blindly does chmod +x on ALL files). Nose does the
63 # right thing and it tries to avoid executables,
69 # right thing and it tries to avoid executables,
64 # setuptools unfortunately forces our hand here. This
70 # setuptools unfortunately forces our hand here. This
65 # has been discussed on the distutils list and the
71 # has been discussed on the distutils list and the
66 # setuptools devs refuse to fix this problem!
72 # setuptools devs refuse to fix this problem!
67 '--exe',
73 '--exe',
68 ]
74 ]
69
75
70 # Detect if any tests were required by explicitly calling an IPython
76 # Detect if any tests were required by explicitly calling an IPython
71 # submodule or giving a specific path
77 # submodule or giving a specific path
72 has_tests = False
78 has_tests = False
73 for arg in sys.argv:
79 for arg in sys.argv:
74 if 'IPython' in arg or arg.endswith('.py') or \
80 if 'IPython' in arg or arg.endswith('.py') or \
75 (':' in arg and '.py' in arg):
81 (':' in arg and '.py' in arg):
76 has_tests = True
82 has_tests = True
77 break
83 break
78 # If nothing was specifically requested, test full IPython
84 # If nothing was specifically requested, test full IPython
79 if not has_tests:
85 if not has_tests:
80 argv.append('IPython')
86 argv.append('IPython')
81
87
82 # Construct list of plugins, omitting the existing doctest plugin.
88 # Construct list of plugins, omitting the existing doctest plugin.
83 plugins = [IPythonDoctest(EXCLUDE)]
89 plugins = [IPythonDoctest(EXCLUDE)]
84 for p in nose.plugins.builtin.plugins:
90 for p in nose.plugins.builtin.plugins:
85 plug = p()
91 plug = p()
86 if plug.name == 'doctest':
92 if plug.name == 'doctest':
87 continue
93 continue
88
94
89 #print '*** adding plugin:',plug.name # dbg
95 #print '*** adding plugin:',plug.name # dbg
90 plugins.append(plug)
96 plugins.append(plug)
91
97
92 TestProgram(argv=argv,plugins=plugins)
98 TestProgram(argv=argv,plugins=plugins)
General Comments 0
You need to be logged in to leave comments. Login now