##// END OF EJS Templates
Reactivate --with-ipdoctest option by default, now that trial is isolated.
Fernando Perez -
Show More
@@ -1,103 +1,103
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/frontend/process/winprocess.py',
38 'IPython/frontend/process/winprocess.py',
39 'IPython_doctest_plugin',
39 'IPython_doctest_plugin',
40 'IPython/Gnuplot',
40 'IPython/Gnuplot',
41 'IPython/Extensions/ipy_',
41 'IPython/Extensions/ipy_',
42 'IPython/Extensions/clearcmd',
42 'IPython/Extensions/clearcmd',
43 'IPython/Extensions/PhysicalQIn',
43 'IPython/Extensions/PhysicalQIn',
44 'IPython/Extensions/scitedirector',
44 'IPython/Extensions/scitedirector',
45 'IPython/Extensions/numeric_formats',
45 'IPython/Extensions/numeric_formats',
46 'IPython/testing/attic',
46 'IPython/testing/attic',
47 ]
47 ]
48
48
49 #-----------------------------------------------------------------------------
49 #-----------------------------------------------------------------------------
50 # Functions and classes
50 # Functions and classes
51 #-----------------------------------------------------------------------------
51 #-----------------------------------------------------------------------------
52
52
53 def main():
53 def main():
54 """Run the IPython test suite.
54 """Run the IPython test suite.
55 """
55 """
56
56
57 warnings.filterwarnings('ignore',
57 warnings.filterwarnings('ignore',
58 'This will be removed soon. Use IPython.testing.util instead')
58 'This will be removed soon. Use IPython.testing.util instead')
59
59
60 argv = sys.argv + [
60 argv = sys.argv + [
61 # Loading ipdoctest causes problems with Twisted.
61 # Loading ipdoctest causes problems with Twisted.
62 # I am removing this as a temporary fix to get the
62 # I am removing this as a temporary fix to get the
63 # test suite back into working shape. Our nose
63 # test suite back into working shape. Our nose
64 # plugin needs to be gone through with a fine
64 # plugin needs to be gone through with a fine
65 # toothed comb to find what is causing the problem.
65 # toothed comb to find what is causing the problem.
66 # '--with-ipdoctest',
66 '--with-ipdoctest',
67 '--ipdoctest-tests','--ipdoctest-extension=txt',
67 '--ipdoctest-tests','--ipdoctest-extension=txt',
68 '--detailed-errors',
68 '--detailed-errors',
69
69
70 # We add --exe because of setuptools' imbecility (it
70 # We add --exe because of setuptools' imbecility (it
71 # blindly does chmod +x on ALL files). Nose does the
71 # blindly does chmod +x on ALL files). Nose does the
72 # right thing and it tries to avoid executables,
72 # right thing and it tries to avoid executables,
73 # setuptools unfortunately forces our hand here. This
73 # setuptools unfortunately forces our hand here. This
74 # has been discussed on the distutils list and the
74 # has been discussed on the distutils list and the
75 # setuptools devs refuse to fix this problem!
75 # setuptools devs refuse to fix this problem!
76 '--exe',
76 '--exe',
77 ]
77 ]
78
78
79 # Detect if any tests were required by explicitly calling an IPython
79 # Detect if any tests were required by explicitly calling an IPython
80 # submodule or giving a specific path
80 # submodule or giving a specific path
81 has_tests = False
81 has_tests = False
82 for arg in sys.argv:
82 for arg in sys.argv:
83 if 'IPython' in arg or arg.endswith('.py') or \
83 if 'IPython' in arg or arg.endswith('.py') or \
84 (':' in arg and '.py' in arg):
84 (':' in arg and '.py' in arg):
85 has_tests = True
85 has_tests = True
86 break
86 break
87
87
88 # If nothing was specifically requested, test full IPython
88 # If nothing was specifically requested, test full IPython
89 if not has_tests:
89 if not has_tests:
90 argv.append('IPython')
90 argv.append('IPython')
91
91
92 # Construct list of plugins, omitting the existing doctest plugin, which
92 # Construct list of plugins, omitting the existing doctest plugin, which
93 # ours replaces (and extends).
93 # ours replaces (and extends).
94 plugins = [IPythonDoctest(EXCLUDE)]
94 plugins = [IPythonDoctest(EXCLUDE)]
95 for p in nose.plugins.builtin.plugins:
95 for p in nose.plugins.builtin.plugins:
96 plug = p()
96 plug = p()
97 if plug.name == 'doctest':
97 if plug.name == 'doctest':
98 continue
98 continue
99
99
100 #print '*** adding plugin:',plug.name # dbg
100 #print '*** adding plugin:',plug.name # dbg
101 plugins.append(plug)
101 plugins.append(plug)
102
102
103 TestProgram(argv=argv,plugins=plugins)
103 TestProgram(argv=argv,plugins=plugins)
General Comments 0
You need to be logged in to leave comments. Login now