Show More
@@ -0,0 +1,53 b'' | |||||
|
1 | #!/usr/bin/env python | |||
|
2 | # -*- coding: utf-8 -*- | |||
|
3 | """IPython Test Suite Runner. | |||
|
4 | """ | |||
|
5 | ||||
|
6 | import sys | |||
|
7 | import warnings | |||
|
8 | ||||
|
9 | from nose.core import TestProgram | |||
|
10 | import nose.plugins.builtin | |||
|
11 | ||||
|
12 | from IPython.testing.plugin.ipdoctest import IPythonDoctest | |||
|
13 | ||||
|
14 | def main(): | |||
|
15 | """Run the IPython test suite. | |||
|
16 | """ | |||
|
17 | ||||
|
18 | warnings.filterwarnings('ignore', | |||
|
19 | 'This will be removed soon. Use IPython.testing.util instead') | |||
|
20 | ||||
|
21 | ||||
|
22 | # construct list of plugins, omitting the existing doctest plugin | |||
|
23 | plugins = [IPythonDoctest()] | |||
|
24 | for p in nose.plugins.builtin.plugins: | |||
|
25 | plug = p() | |||
|
26 | if plug.name == 'doctest': | |||
|
27 | continue | |||
|
28 | ||||
|
29 | #print 'adding plugin:',plug.name # dbg | |||
|
30 | plugins.append(plug) | |||
|
31 | ||||
|
32 | argv = sys.argv + ['--doctest-tests','--doctest-extension=txt', | |||
|
33 | '--detailed-errors', | |||
|
34 | ||||
|
35 | # We add --exe because of setuptools' imbecility (it | |||
|
36 | # blindly does chmod +x on ALL files). Nose does the | |||
|
37 | # right thing and it tries to avoid executables, | |||
|
38 | # setuptools unfortunately forces our hand here. This | |||
|
39 | # has been discussed on the distutils list and the | |||
|
40 | # setuptools devs refuse to fix this problem! | |||
|
41 | '--exe', | |||
|
42 | ] | |||
|
43 | ||||
|
44 | has_ip = False | |||
|
45 | for arg in sys.argv: | |||
|
46 | if 'IPython' in arg: | |||
|
47 | has_ip = True | |||
|
48 | break | |||
|
49 | ||||
|
50 | if not has_ip: | |||
|
51 | argv.append('IPython') | |||
|
52 | ||||
|
53 | TestProgram(argv=argv,plugins=plugins) |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
@@ -0,0 +1,8 b'' | |||||
|
1 | #!/usr/bin/env python | |||
|
2 | # -*- coding: utf-8 -*- | |||
|
3 | """IPython Test Suite Runner. | |||
|
4 | """ | |||
|
5 | ||||
|
6 | from IPython.testing import iptest | |||
|
7 | ||||
|
8 | iptest.main() |
@@ -40,11 +40,12 b' except ImportError:' | |||||
40 | # IPython imports |
|
40 | # IPython imports | |
41 | import IPython |
|
41 | import IPython | |
42 | from IPython import ultraTB, ipapi |
|
42 | from IPython import ultraTB, ipapi | |
|
43 | from IPython.Magic import Magic | |||
43 | from IPython.genutils import Term,warn,error,flag_calls, ask_yes_no |
|
44 | from IPython.genutils import Term,warn,error,flag_calls, ask_yes_no | |
44 | from IPython.iplib import InteractiveShell |
|
45 | from IPython.iplib import InteractiveShell | |
45 | from IPython.ipmaker import make_IPython |
|
46 | from IPython.ipmaker import make_IPython | |
46 | from IPython.Magic import Magic |
|
|||
47 | from IPython.ipstruct import Struct |
|
47 | from IPython.ipstruct import Struct | |
|
48 | from IPython.testing import decorators as testdec | |||
48 |
|
49 | |||
49 | # Globals |
|
50 | # Globals | |
50 | # global flag to pass around information about Ctrl-C without exceptions |
|
51 | # global flag to pass around information about Ctrl-C without exceptions | |
@@ -607,7 +608,8 b' class MatplotlibShellBase:' | |||||
607 | # if a backend switch was performed, reverse it now |
|
608 | # if a backend switch was performed, reverse it now | |
608 | if self.mpl_use._called: |
|
609 | if self.mpl_use._called: | |
609 | self.matplotlib.rcParams['backend'] = self.mpl_backend |
|
610 | self.matplotlib.rcParams['backend'] = self.mpl_backend | |
610 |
|
611 | |||
|
612 | @testdec.skip_doctest | |||
611 | def magic_run(self,parameter_s=''): |
|
613 | def magic_run(self,parameter_s=''): | |
612 | Magic.magic_run(self,parameter_s,runner=self.mplot_exec) |
|
614 | Magic.magic_run(self,parameter_s,runner=self.mplot_exec) | |
613 |
|
615 |
@@ -17,6 +17,7 b' from time import sleep' | |||||
17 | import sys |
|
17 | import sys | |
18 |
|
18 | |||
19 | from IPython.frontend._process import PipedProcess |
|
19 | from IPython.frontend._process import PipedProcess | |
|
20 | from IPython.testing import decorators as testdec | |||
20 |
|
21 | |||
21 | def test_capture_out(): |
|
22 | def test_capture_out(): | |
22 | """ A simple test to see if we can execute a process and get the output. |
|
23 | """ A simple test to see if we can execute a process and get the output. | |
@@ -25,9 +26,11 b' def test_capture_out():' | |||||
25 | p = PipedProcess('echo 1', out_callback=s.write, ) |
|
26 | p = PipedProcess('echo 1', out_callback=s.write, ) | |
26 | p.start() |
|
27 | p.start() | |
27 | p.join() |
|
28 | p.join() | |
28 | assert s.getvalue() == '1\n' |
|
29 | result = s.getvalue().rstrip() | |
29 |
|
30 | assert result == '1' | ||
30 |
|
31 | |||
|
32 | # FIXME | |||
|
33 | @testdec.skip("This doesn't work under Windows") | |||
31 | def test_io(): |
|
34 | def test_io(): | |
32 | """ Checks that we can send characters on stdin to the process. |
|
35 | """ Checks that we can send characters on stdin to the process. | |
33 | """ |
|
36 | """ | |
@@ -40,7 +43,8 b' def test_io():' | |||||
40 | sleep(0.1) |
|
43 | sleep(0.1) | |
41 | p.process.stdin.write(test_string) |
|
44 | p.process.stdin.write(test_string) | |
42 | p.join() |
|
45 | p.join() | |
43 |
|
|
46 | result = s.getvalue() | |
|
47 | assert result == test_string | |||
44 |
|
48 | |||
45 |
|
49 | |||
46 | def test_kill(): |
|
50 | def test_kill(): |
@@ -16,7 +16,10 b' __docformat__ = "restructuredtext en"' | |||||
16 | import os |
|
16 | import os | |
17 | from cStringIO import StringIO |
|
17 | from cStringIO import StringIO | |
18 |
|
18 | |||
|
19 | from IPython.testing import decorators as testdec | |||
19 |
|
20 | |||
|
21 | # FIXME | |||
|
22 | @testdec.skip("This doesn't work under Windows") | |||
20 | def test_redirector(): |
|
23 | def test_redirector(): | |
21 | """ Checks that the redirector can be used to do synchronous capture. |
|
24 | """ Checks that the redirector can be used to do synchronous capture. | |
22 | """ |
|
25 | """ | |
@@ -33,9 +36,12 b' def test_redirector():' | |||||
33 | r.stop() |
|
36 | r.stop() | |
34 | raise |
|
37 | raise | |
35 | r.stop() |
|
38 | r.stop() | |
36 | assert out.getvalue() == "".join("%ic\n%i\n" %(i, i) for i in range(10)) |
|
39 | result1 = out.getvalue() | |
37 |
|
40 | result2 = "".join("%ic\n%i\n" %(i, i) for i in range(10)) | ||
|
41 | assert result1 == result2 | |||
38 |
|
42 | |||
|
43 | # FIXME | |||
|
44 | @testdec.skip("This doesn't work under Windows") | |||
39 | def test_redirector_output_trap(): |
|
45 | def test_redirector_output_trap(): | |
40 | """ This test check not only that the redirector_output_trap does |
|
46 | """ This test check not only that the redirector_output_trap does | |
41 | trap the output, but also that it does it in a gready way, that |
|
47 | trap the output, but also that it does it in a gready way, that | |
@@ -54,8 +60,9 b' def test_redirector_output_trap():' | |||||
54 | trap.unset() |
|
60 | trap.unset() | |
55 | raise |
|
61 | raise | |
56 | trap.unset() |
|
62 | trap.unset() | |
57 | assert out.getvalue() == "".join("%ic\n%ip\n%i\n" %(i, i, i) |
|
63 | result1 = out.getvalue() | |
58 | for i in range(10)) |
|
64 | result2 = "".join("%ic\n%ip\n%i\n" %(i, i, i) for i in range(10)) | |
|
65 | assert result1 == result2 | |||
59 |
|
66 | |||
60 |
|
67 | |||
61 |
|
68 |
@@ -120,16 +120,28 b" skip_doctest = make_label_dec('skip_doctest'," | |||||
120 | omit from testing, while preserving the docstring for introspection, help, |
|
120 | omit from testing, while preserving the docstring for introspection, help, | |
121 | etc.""") |
|
121 | etc.""") | |
122 |
|
122 | |||
|
123 | def skip(msg=''): | |||
|
124 | """Decorator - mark a test function for skipping from test suite. | |||
123 |
|
|
125 | ||
124 | def skip(func): |
|
126 | :Parameters: | |
125 | """Decorator - mark a test function for skipping from test suite.""" |
|
127 | ||
|
128 | func : function | |||
|
129 | Test function to be skipped | |||
|
130 | ||||
|
131 | msg : string | |||
|
132 | Optional message to be added. | |||
|
133 | """ | |||
126 |
|
134 | |||
127 | import nose |
|
135 | import nose | |
128 |
|
||||
129 | def wrapper(*a,**k): |
|
|||
130 | raise nose.SkipTest("Skipping test for function: %s" % |
|
|||
131 | func.__name__) |
|
|||
132 |
|
||||
133 | return apply_wrapper(wrapper,func) |
|
|||
134 |
|
136 | |||
|
137 | def inner(func): | |||
|
138 | ||||
|
139 | def wrapper(*a,**k): | |||
|
140 | if msg: out = '\n'+msg | |||
|
141 | else: out = '' | |||
|
142 | raise nose.SkipTest("Skipping test for function: %s%s" % | |||
|
143 | (func.__name__,out)) | |||
|
144 | ||||
|
145 | return apply_wrapper(wrapper,func) | |||
135 |
|
146 | |||
|
147 | return inner |
@@ -658,6 +658,24 b' class ExtensionDoctest(doctests.Doctest):' | |||||
658 |
|
658 | |||
659 | def options(self, parser, env=os.environ): |
|
659 | def options(self, parser, env=os.environ): | |
660 | Plugin.options(self, parser, env) |
|
660 | Plugin.options(self, parser, env) | |
|
661 | parser.add_option('--doctest-tests', action='store_true', | |||
|
662 | dest='doctest_tests', | |||
|
663 | default=env.get('NOSE_DOCTEST_TESTS',True), | |||
|
664 | help="Also look for doctests in test modules. " | |||
|
665 | "Note that classes, methods and functions should " | |||
|
666 | "have either doctests or non-doctest tests, " | |||
|
667 | "not both. [NOSE_DOCTEST_TESTS]") | |||
|
668 | parser.add_option('--doctest-extension', action="append", | |||
|
669 | dest="doctestExtension", | |||
|
670 | help="Also look for doctests in files with " | |||
|
671 | "this extension [NOSE_DOCTEST_EXTENSION]") | |||
|
672 | # Set the default as a list, if given in env; otherwise | |||
|
673 | # an additional value set on the command line will cause | |||
|
674 | # an error. | |||
|
675 | env_setting = env.get('NOSE_DOCTEST_EXTENSION') | |||
|
676 | if env_setting is not None: | |||
|
677 | parser.set_defaults(doctestExtension=tolist(env_setting)) | |||
|
678 | ||||
661 |
|
679 | |||
662 | def configure(self, options, config): |
|
680 | def configure(self, options, config): | |
663 | Plugin.configure(self, options, config) |
|
681 | Plugin.configure(self, options, config) | |
@@ -743,16 +761,19 b' class ExtensionDoctest(doctests.Doctest):' | |||||
743 | Modified version that accepts extension modules as valid containers for |
|
761 | Modified version that accepts extension modules as valid containers for | |
744 | doctests. |
|
762 | doctests. | |
745 | """ |
|
763 | """ | |
746 |
|
|
764 | print 'Filename:',filename # dbg | |
747 |
|
765 | |||
748 | # XXX - temporarily hardcoded list, will move to driver later |
|
766 | # XXX - temporarily hardcoded list, will move to driver later | |
749 | exclude = ['IPython/external/', |
|
767 | exclude = ['IPython/external/', | |
750 | 'IPython/Extensions/ipy_', |
|
|||
751 | 'IPython/platutils_win32', |
|
768 | 'IPython/platutils_win32', | |
752 | 'IPython/frontend/cocoa', |
|
769 | 'IPython/frontend/cocoa', | |
753 | 'IPython_doctest_plugin', |
|
770 | 'IPython_doctest_plugin', | |
754 | 'IPython/Gnuplot', |
|
771 | 'IPython/Gnuplot', | |
755 |
'IPython/Extensions/ |
|
772 | 'IPython/Extensions/ipy_', | |
|
773 | 'IPython/Extensions/PhysicalQIn', | |||
|
774 | 'IPython/Extensions/scitedirector', | |||
|
775 | 'IPython/testing/plugin', | |||
|
776 | ] | |||
756 |
|
777 | |||
757 | for fex in exclude: |
|
778 | for fex in exclude: | |
758 | if fex in filename: # substring |
|
779 | if fex in filename: # substring | |
@@ -782,3 +803,4 b' class IPythonDoctest(ExtensionDoctest):' | |||||
782 | self.checker = IPDoctestOutputChecker() |
|
803 | self.checker = IPDoctestOutputChecker() | |
783 | self.globs = None |
|
804 | self.globs = None | |
784 | self.extraglobs = None |
|
805 | self.extraglobs = None | |
|
806 |
@@ -45,6 +45,11 b' def test_deliberately_broken():' | |||||
45 | """A deliberately broken test - we want to skip this one.""" |
|
45 | """A deliberately broken test - we want to skip this one.""" | |
46 | 1/0 |
|
46 | 1/0 | |
47 |
|
47 | |||
|
48 | @dec.skip('foo') | |||
|
49 | def test_deliberately_broken2(): | |||
|
50 | """Another deliberately broken test - we want to skip this one.""" | |||
|
51 | 1/0 | |||
|
52 | ||||
48 |
|
53 | |||
49 | # Verify that we can correctly skip the doctest for a function at will, but |
|
54 | # Verify that we can correctly skip the doctest for a function at will, but | |
50 | # that the docstring itself is NOT destroyed by the decorator. |
|
55 | # that the docstring itself is NOT destroyed by the decorator. |
@@ -9,6 +9,7 b' Utilities for testing code.' | |||||
9 | # testing machinery from snakeoil that were good have already been merged into |
|
9 | # testing machinery from snakeoil that were good have already been merged into | |
10 | # the nose plugin, so this can be taken away soon. Leave a warning for now, |
|
10 | # the nose plugin, so this can be taken away soon. Leave a warning for now, | |
11 | # we'll remove it in a later release (around 0.10 or so). |
|
11 | # we'll remove it in a later release (around 0.10 or so). | |
|
12 | ||||
12 | from warnings import warn |
|
13 | from warnings import warn | |
13 | warn('This will be removed soon. Use IPython.testing.util instead', |
|
14 | warn('This will be removed soon. Use IPython.testing.util instead', | |
14 | DeprecationWarning) |
|
15 | DeprecationWarning) |
@@ -445,7 +445,8 b' class ListTB(TBTools):' | |||||
445 |
|
445 | |||
446 | Also lifted nearly verbatim from traceback.py |
|
446 | Also lifted nearly verbatim from traceback.py | |
447 | """ |
|
447 | """ | |
448 |
|
448 | |||
|
449 | have_filedata = False | |||
449 | Colors = self.Colors |
|
450 | Colors = self.Colors | |
450 | list = [] |
|
451 | list = [] | |
451 | try: |
|
452 | try: |
@@ -354,8 +354,8 b' Installation and testing scenarios' | |||||
354 |
|
354 | |||
355 | This section outlines the various scenarios that we need to test before we release an IPython version. These scenarios represent different ways of installing IPython and its dependencies. |
|
355 | This section outlines the various scenarios that we need to test before we release an IPython version. These scenarios represent different ways of installing IPython and its dependencies. | |
356 |
|
356 | |||
357 | Installation scenarios |
|
357 | Installation scenarios under Linux and OS X | |
358 | ---------------------- |
|
358 | ------------------------------------------- | |
359 |
|
359 | |||
360 | 1. Install from tarball using `python setup.py install`. |
|
360 | 1. Install from tarball using `python setup.py install`. | |
361 | a. With only readline+nose dependencies installed. |
|
361 | a. With only readline+nose dependencies installed. | |
@@ -367,6 +367,12 b' Installation scenarios' | |||||
367 | ii. Optional dependency sets: `easy_install -f ipython-0.9.beta3-py2.5.egg IPython[kernel,doc,test,security]` |
|
367 | ii. Optional dependency sets: `easy_install -f ipython-0.9.beta3-py2.5.egg IPython[kernel,doc,test,security]` | |
368 | b. With all dependencies already installed. |
|
368 | b. With all dependencies already installed. | |
369 |
|
369 | |||
|
370 | Installation scenarios under Win32 | |||
|
371 | ---------------------------------- | |||
|
372 | ||||
|
373 | 1. Install everything from .exe installers | |||
|
374 | 2. easy_install? | |||
|
375 | ||||
370 |
|
376 | |||
371 | Tests to run for these scenarios |
|
377 | Tests to run for these scenarios | |
372 | -------------------------------- |
|
378 | -------------------------------- |
@@ -137,23 +137,22 b" if 'setuptools' in sys.modules:" | |||||
137 | 'ipcontroller = IPython.kernel.scripts.ipcontroller:main', |
|
137 | 'ipcontroller = IPython.kernel.scripts.ipcontroller:main', | |
138 | 'ipengine = IPython.kernel.scripts.ipengine:main', |
|
138 | 'ipengine = IPython.kernel.scripts.ipengine:main', | |
139 | 'ipcluster = IPython.kernel.scripts.ipcluster:main', |
|
139 | 'ipcluster = IPython.kernel.scripts.ipcluster:main', | |
140 | 'ipythonx = IPython.frontend.wx.ipythonx:main' |
|
140 | 'ipythonx = IPython.frontend.wx.ipythonx:main', | |
|
141 | 'iptest = IPython.testing.iptest:main', | |||
141 | ] |
|
142 | ] | |
142 | } |
|
143 | } | |
143 |
setup_args[ |
|
144 | setup_args['extras_require'] = dict( | |
144 | kernel = [ |
|
145 | kernel = [ | |
145 |
|
|
146 | 'zope.interface>=3.4.1', | |
146 |
|
|
147 | 'Twisted>=8.0.1', | |
147 |
|
|
148 | 'foolscap>=0.2.6' | |
148 | ], |
|
149 | ], | |
149 |
doc= |
|
150 | doc='Sphinx>=0.3', | |
150 | test='nose>=0.10.1', |
|
151 | test='nose>=0.10.1', | |
151 |
security= |
|
152 | security='pyOpenSSL>=0.6' | |
152 | ) |
|
153 | ) | |
153 | # Allow setuptools to handle the scripts |
|
154 | # Allow setuptools to handle the scripts | |
154 | scripts = [] |
|
155 | scripts = [] | |
155 | # eggs will lack docs, examples |
|
|||
156 | data_files = [] |
|
|||
157 | else: |
|
156 | else: | |
158 | # package_data of setuptools was introduced to distutils in 2.4 |
|
157 | # package_data of setuptools was introduced to distutils in 2.4 | |
159 | cfgfiles = filter(isfile, glob('IPython/UserConfig/*')) |
|
158 | cfgfiles = filter(isfile, glob('IPython/UserConfig/*')) |
@@ -115,6 +115,7 b' def find_packages():' | |||||
115 | add_package(packages, 'kernel', config=True, tests=True, scripts=True) |
|
115 | add_package(packages, 'kernel', config=True, tests=True, scripts=True) | |
116 | add_package(packages, 'kernel.core', config=True, tests=True) |
|
116 | add_package(packages, 'kernel.core', config=True, tests=True) | |
117 | add_package(packages, 'testing', tests=True) |
|
117 | add_package(packages, 'testing', tests=True) | |
|
118 | add_package(packages, 'testing.plugin', tests=False) | |||
118 | add_package(packages, 'tools', tests=True) |
|
119 | add_package(packages, 'tools', tests=True) | |
119 | add_package(packages, 'UserConfig') |
|
120 | add_package(packages, 'UserConfig') | |
120 | return packages |
|
121 | return packages | |
@@ -220,11 +221,12 b' def find_scripts():' | |||||
220 | """ |
|
221 | """ | |
221 | scripts = ['IPython/kernel/scripts/ipengine', |
|
222 | scripts = ['IPython/kernel/scripts/ipengine', | |
222 | 'IPython/kernel/scripts/ipcontroller', |
|
223 | 'IPython/kernel/scripts/ipcontroller', | |
223 |
|
|
224 | 'IPython/kernel/scripts/ipcluster', | |
224 | 'scripts/ipython', |
|
225 | 'scripts/ipython', | |
225 | 'scripts/ipythonx', |
|
226 | 'scripts/ipythonx', | |
226 | 'scripts/pycolor', |
|
227 | 'scripts/pycolor', | |
227 | 'scripts/irunner', |
|
228 | 'scripts/irunner', | |
|
229 | 'scripts/iptest', | |||
228 | ] |
|
230 | ] | |
229 |
|
231 | |||
230 | # Script to be run by the windows binary installer after the default setup |
|
232 | # Script to be run by the windows binary installer after the default setup |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now