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