##// END OF EJS Templates
Merge with upstream
Gael Varoquaux -
r1620:ed1093e0 merge
parent child Browse files
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
@@ -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 40 # IPython imports
41 41 import IPython
42 42 from IPython import ultraTB, ipapi
43 from IPython.Magic import Magic
43 44 from IPython.genutils import Term,warn,error,flag_calls, ask_yes_no
44 45 from IPython.iplib import InteractiveShell
45 46 from IPython.ipmaker import make_IPython
46 from IPython.Magic import Magic
47 47 from IPython.ipstruct import Struct
48 from IPython.testing import decorators as testdec
48 49
49 50 # Globals
50 51 # global flag to pass around information about Ctrl-C without exceptions
@@ -607,7 +608,8 b' class MatplotlibShellBase:'
607 608 # if a backend switch was performed, reverse it now
608 609 if self.mpl_use._called:
609 610 self.matplotlib.rcParams['backend'] = self.mpl_backend
610
611
612 @testdec.skip_doctest
611 613 def magic_run(self,parameter_s=''):
612 614 Magic.magic_run(self,parameter_s,runner=self.mplot_exec)
613 615
@@ -17,6 +17,7 b' from time import sleep'
17 17 import sys
18 18
19 19 from IPython.frontend._process import PipedProcess
20 from IPython.testing import decorators as testdec
20 21
21 22 def test_capture_out():
22 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 26 p = PipedProcess('echo 1', out_callback=s.write, )
26 27 p.start()
27 28 p.join()
28 assert s.getvalue() == '1\n'
29
29 result = s.getvalue().rstrip()
30 assert result == '1'
30 31
32 # FIXME
33 @testdec.skip("This doesn't work under Windows")
31 34 def test_io():
32 35 """ Checks that we can send characters on stdin to the process.
33 36 """
@@ -40,7 +43,8 b' def test_io():'
40 43 sleep(0.1)
41 44 p.process.stdin.write(test_string)
42 45 p.join()
43 assert s.getvalue() == test_string
46 result = s.getvalue()
47 assert result == test_string
44 48
45 49
46 50 def test_kill():
@@ -16,7 +16,10 b' __docformat__ = "restructuredtext en"'
16 16 import os
17 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 23 def test_redirector():
21 24 """ Checks that the redirector can be used to do synchronous capture.
22 25 """
@@ -33,9 +36,12 b' def test_redirector():'
33 36 r.stop()
34 37 raise
35 38 r.stop()
36 assert out.getvalue() == "".join("%ic\n%i\n" %(i, i) for i in range(10))
37
39 result1 = out.getvalue()
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 45 def test_redirector_output_trap():
40 46 """ This test check not only that the redirector_output_trap does
41 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 60 trap.unset()
55 61 raise
56 62 trap.unset()
57 assert out.getvalue() == "".join("%ic\n%ip\n%i\n" %(i, i, i)
58 for i in range(10))
63 result1 = out.getvalue()
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 120 omit from testing, while preserving the docstring for introspection, help,
121 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):
125 """Decorator - mark a test function for skipping from test suite."""
126 :Parameters:
127
128 func : function
129 Test function to be skipped
130
131 msg : string
132 Optional message to be added.
133 """
126 134
127 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 659 def options(self, parser, env=os.environ):
660 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 680 def configure(self, options, config):
663 681 Plugin.configure(self, options, config)
@@ -743,16 +761,19 b' class ExtensionDoctest(doctests.Doctest):'
743 761 Modified version that accepts extension modules as valid containers for
744 762 doctests.
745 763 """
746 #print 'Filename:',filename # dbg
764 print 'Filename:',filename # dbg
747 765
748 766 # XXX - temporarily hardcoded list, will move to driver later
749 767 exclude = ['IPython/external/',
750 'IPython/Extensions/ipy_',
751 768 'IPython/platutils_win32',
752 769 'IPython/frontend/cocoa',
753 770 'IPython_doctest_plugin',
754 771 'IPython/Gnuplot',
755 'IPython/Extensions/PhysicalQIn']
772 'IPython/Extensions/ipy_',
773 'IPython/Extensions/PhysicalQIn',
774 'IPython/Extensions/scitedirector',
775 'IPython/testing/plugin',
776 ]
756 777
757 778 for fex in exclude:
758 779 if fex in filename: # substring
@@ -782,3 +803,4 b' class IPythonDoctest(ExtensionDoctest):'
782 803 self.checker = IPDoctestOutputChecker()
783 804 self.globs = None
784 805 self.extraglobs = None
806
@@ -45,6 +45,11 b' def test_deliberately_broken():'
45 45 """A deliberately broken test - we want to skip this one."""
46 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 54 # Verify that we can correctly skip the doctest for a function at will, but
50 55 # that the docstring itself is NOT destroyed by the decorator.
@@ -9,6 +9,7 b' Utilities for testing code.'
9 9 # testing machinery from snakeoil that were good have already been merged into
10 10 # the nose plugin, so this can be taken away soon. Leave a warning for now,
11 11 # we'll remove it in a later release (around 0.10 or so).
12
12 13 from warnings import warn
13 14 warn('This will be removed soon. Use IPython.testing.util instead',
14 15 DeprecationWarning)
@@ -445,7 +445,8 b' class ListTB(TBTools):'
445 445
446 446 Also lifted nearly verbatim from traceback.py
447 447 """
448
448
449 have_filedata = False
449 450 Colors = self.Colors
450 451 list = []
451 452 try:
@@ -354,8 +354,8 b' Installation and testing scenarios'
354 354
355 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
358 ----------------------
357 Installation scenarios under Linux and OS X
358 -------------------------------------------
359 359
360 360 1. Install from tarball using `python setup.py install`.
361 361 a. With only readline+nose dependencies installed.
@@ -367,6 +367,12 b' Installation scenarios'
367 367 ii. Optional dependency sets: `easy_install -f ipython-0.9.beta3-py2.5.egg IPython[kernel,doc,test,security]`
368 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 377 Tests to run for these scenarios
372 378 --------------------------------
@@ -137,23 +137,22 b" if 'setuptools' in sys.modules:"
137 137 'ipcontroller = IPython.kernel.scripts.ipcontroller:main',
138 138 'ipengine = IPython.kernel.scripts.ipengine:main',
139 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["extras_require"] = dict(
144 setup_args['extras_require'] = dict(
144 145 kernel = [
145 "zope.interface>=3.4.1",
146 "Twisted>=8.0.1",
147 "foolscap>=0.2.6"
146 'zope.interface>=3.4.1',
147 'Twisted>=8.0.1',
148 'foolscap>=0.2.6'
148 149 ],
149 doc=['Sphinx>=0.3','pygments'],
150 doc='Sphinx>=0.3',
150 151 test='nose>=0.10.1',
151 security=["pyOpenSSL>=0.6"]
152 security='pyOpenSSL>=0.6'
152 153 )
153 154 # Allow setuptools to handle the scripts
154 155 scripts = []
155 # eggs will lack docs, examples
156 data_files = []
157 156 else:
158 157 # package_data of setuptools was introduced to distutils in 2.4
159 158 cfgfiles = filter(isfile, glob('IPython/UserConfig/*'))
@@ -115,6 +115,7 b' def find_packages():'
115 115 add_package(packages, 'kernel', config=True, tests=True, scripts=True)
116 116 add_package(packages, 'kernel.core', config=True, tests=True)
117 117 add_package(packages, 'testing', tests=True)
118 add_package(packages, 'testing.plugin', tests=False)
118 119 add_package(packages, 'tools', tests=True)
119 120 add_package(packages, 'UserConfig')
120 121 return packages
@@ -220,11 +221,12 b' def find_scripts():'
220 221 """
221 222 scripts = ['IPython/kernel/scripts/ipengine',
222 223 'IPython/kernel/scripts/ipcontroller',
223 'IPython/kernel/scripts/ipcluster',
224 'IPython/kernel/scripts/ipcluster',
224 225 'scripts/ipython',
225 226 'scripts/ipythonx',
226 227 'scripts/pycolor',
227 228 'scripts/irunner',
229 'scripts/iptest',
228 230 ]
229 231
230 232 # Script to be run by the windows binary installer after the default setup
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now