##// END OF EJS Templates
Fixes so the test suite runs when Twisted is not available....
Fernando Perez -
Show More
@@ -3,6 +3,9 b' Base front end class for all async frontends.'
3 """
3 """
4 __docformat__ = "restructuredtext en"
4 __docformat__ = "restructuredtext en"
5
5
6 # Tell nose to skip this module
7 __test__ = {}
8
6 #-------------------------------------------------------------------------------
9 #-------------------------------------------------------------------------------
7 # Copyright (C) 2008 The IPython Development Team
10 # Copyright (C) 2008 The IPython Development Team
8 #
11 #
@@ -10,20 +13,25 b' __docformat__ = "restructuredtext en"'
10 # the file COPYING, distributed as part of this software.
13 # the file COPYING, distributed as part of this software.
11 #-------------------------------------------------------------------------------
14 #-------------------------------------------------------------------------------
12
15
13
14 #-------------------------------------------------------------------------------
16 #-------------------------------------------------------------------------------
15 # Imports
17 # Imports
16 #-------------------------------------------------------------------------------
18 #-------------------------------------------------------------------------------
17
19
20 # Third-party
21 from twisted.python.failure import Failure
22 from zope.interface import implements, classProvides
23
24 # From IPython
18 from IPython.external import guid
25 from IPython.external import guid
19
26
20 from zope.interface import Interface, Attribute, implements, classProvides
27 from IPython.frontend.frontendbase import (FrontEndBase, IFrontEnd,
21 from twisted.python.failure import Failure
28 IFrontEndFactory)
22 from IPython.frontend.frontendbase import (
23 FrontEndBase, IFrontEnd, IFrontEndFactory)
24 from IPython.kernel.core.history import FrontEndHistory
29 from IPython.kernel.core.history import FrontEndHistory
25 from IPython.kernel.engineservice import IEngineCore
30 from IPython.kernel.engineservice import IEngineCore
26
31
32 #-----------------------------------------------------------------------------
33 # Classes and functions
34 #-----------------------------------------------------------------------------
27
35
28 class AsyncFrontEndBase(FrontEndBase):
36 class AsyncFrontEndBase(FrontEndBase):
29 """
37 """
@@ -41,8 +49,7 b' class AsyncFrontEndBase(FrontEndBase):'
41 self.history = FrontEndHistory(input_cache=[''])
49 self.history = FrontEndHistory(input_cache=[''])
42 else:
50 else:
43 self.history = history
51 self.history = history
44
52
45
46 def execute(self, block, blockID=None):
53 def execute(self, block, blockID=None):
47 """Execute the block and return the deferred result.
54 """Execute the block and return the deferred result.
48
55
@@ -73,5 +80,3 b' class AsyncFrontEndBase(FrontEndBase):'
73 errback=self.render_error)
80 errback=self.render_error)
74
81
75 return d
82 return d
76
77
@@ -3,6 +3,9 b''
3 """This file contains unittests for the asyncfrontendbase module."""
3 """This file contains unittests for the asyncfrontendbase module."""
4
4
5 __docformat__ = "restructuredtext en"
5 __docformat__ = "restructuredtext en"
6
7 # Tell nose to skip this module
8 __test__ = {}
6
9
7 #---------------------------------------------------------------------------
10 #---------------------------------------------------------------------------
8 # Copyright (C) 2008 The IPython Development Team
11 # Copyright (C) 2008 The IPython Development Team
@@ -10,20 +13,21 b' __docformat__ = "restructuredtext en"'
10 # Distributed under the terms of the BSD License. The full license is in
13 # Distributed under the terms of the BSD License. The full license is in
11 # the file COPYING, distributed as part of this software.
14 # the file COPYING, distributed as part of this software.
12 #---------------------------------------------------------------------------
15 #---------------------------------------------------------------------------
13
16
14 #---------------------------------------------------------------------------
17 #---------------------------------------------------------------------------
15 # Imports
18 # Imports
16 #---------------------------------------------------------------------------
19 #---------------------------------------------------------------------------
17
20
18 # Tell nose to skip this module
19 __test__ = {}
20
21 from twisted.trial import unittest
21 from twisted.trial import unittest
22
22 from IPython.frontend.asyncfrontendbase import AsyncFrontEndBase
23 from IPython.frontend.asyncfrontendbase import AsyncFrontEndBase
23 from IPython.frontend import frontendbase
24 from IPython.frontend import frontendbase
24 from IPython.kernel.engineservice import EngineService
25 from IPython.kernel.engineservice import EngineService
25 from IPython.testing.parametric import Parametric, parametric
26 from IPython.testing.parametric import Parametric, parametric
26
27
28 #-----------------------------------------------------------------------------
29 # Classes and functions
30 #-----------------------------------------------------------------------------
27
31
28 class FrontEndCallbackChecker(AsyncFrontEndBase):
32 class FrontEndCallbackChecker(AsyncFrontEndBase):
29 """FrontEndBase subclass for checking callbacks"""
33 """FrontEndBase subclass for checking callbacks"""
@@ -106,4 +110,3 b' class TestAsyncFrontendBase(unittest.TestCase):'
106 def test_history_returns_none_at_startup(self):
110 def test_history_returns_none_at_startup(self):
107 self.assert_(self.fb.get_history_previous("")==None)
111 self.assert_(self.fb.get_history_previous("")==None)
108 self.assert_(self.fb.get_history_next()==None)
112 self.assert_(self.fb.get_history_next()==None)
109
@@ -23,6 +23,9 b' method that automatically added methods to engines.'
23
23
24 __docformat__ = "restructuredtext en"
24 __docformat__ = "restructuredtext en"
25
25
26 # Tell nose to skip this module
27 __test__ = {}
28
26 #-------------------------------------------------------------------------------
29 #-------------------------------------------------------------------------------
27 # Copyright (C) 2008 The IPython Development Team
30 # Copyright (C) 2008 The IPython Development Team
28 #
31 #
@@ -34,12 +37,9 b' __docformat__ = "restructuredtext en"'
34 # Imports
37 # Imports
35 #-------------------------------------------------------------------------------
38 #-------------------------------------------------------------------------------
36
39
37 # Tell nose to skip the testing of this module
40 import copy
38 __test__ = {}
41 import sys
39
40 import os, sys, copy
41 import cPickle as pickle
42 import cPickle as pickle
42 from new import instancemethod
43
43
44 from twisted.application import service
44 from twisted.application import service
45 from twisted.internet import defer, reactor
45 from twisted.internet import defer, reactor
@@ -47,11 +47,7 b' from twisted.python import log, failure, components'
47 import zope.interface as zi
47 import zope.interface as zi
48
48
49 from IPython.kernel.core.interpreter import Interpreter
49 from IPython.kernel.core.interpreter import Interpreter
50 from IPython.kernel import newserialized, error, util
50 from IPython.kernel import newserialized, error
51 from IPython.kernel.util import printer
52 from IPython.kernel.twistedutil import gatherBoth, DeferredList
53 from IPython.kernel import codeutil
54
55
51
56 #-------------------------------------------------------------------------------
52 #-------------------------------------------------------------------------------
57 # Interface specification for the Engine
53 # Interface specification for the Engine
@@ -4,6 +4,9 b''
4
4
5 __docformat__ = "restructuredtext en"
5 __docformat__ = "restructuredtext en"
6
6
7 # Tell nose to skip this module
8 __test__ = {}
9
7 #-------------------------------------------------------------------------------
10 #-------------------------------------------------------------------------------
8 # Copyright (C) 2008 The IPython Development Team
11 # Copyright (C) 2008 The IPython Development Team
9 #
12 #
@@ -14,9 +17,9 b' __docformat__ = "restructuredtext en"'
14 #-------------------------------------------------------------------------------
17 #-------------------------------------------------------------------------------
15 # Imports
18 # Imports
16 #-------------------------------------------------------------------------------
19 #-------------------------------------------------------------------------------
20 from twisted.python import failure
17
21
18 from IPython.kernel.core import error
22 from IPython.kernel.core import error
19 from twisted.python import failure
20
23
21 #-------------------------------------------------------------------------------
24 #-------------------------------------------------------------------------------
22 # Error classes
25 # Error classes
@@ -5,6 +5,9 b''
5
5
6 __docformat__ = "restructuredtext en"
6 __docformat__ = "restructuredtext en"
7
7
8 # Tell nose to skip this module
9 __test__ = {}
10
8 #-------------------------------------------------------------------------------
11 #-------------------------------------------------------------------------------
9 # Copyright (C) 2008 The IPython Development Team
12 # Copyright (C) 2008 The IPython Development Team
10 #
13 #
@@ -18,8 +21,8 b' __docformat__ = "restructuredtext en"'
18
21
19 import cPickle as pickle
22 import cPickle as pickle
20
23
21 from zope.interface import Interface, implements
22 from twisted.python import components
24 from twisted.python import components
25 from zope.interface import Interface, implements
23
26
24 try:
27 try:
25 import numpy
28 import numpy
@@ -28,6 +31,10 b' except ImportError:'
28
31
29 from IPython.kernel.error import SerializationError
32 from IPython.kernel.error import SerializationError
30
33
34 #-----------------------------------------------------------------------------
35 # Classes and functions
36 #-----------------------------------------------------------------------------
37
31 class ISerialized(Interface):
38 class ISerialized(Interface):
32
39
33 def getData():
40 def getData():
@@ -107,6 +107,23 b" if not os.name == 'posix':"
107 if not have_pexpect:
107 if not have_pexpect:
108 EXCLUDE.append(pjoin('IPython', 'irunner'))
108 EXCLUDE.append(pjoin('IPython', 'irunner'))
109
109
110 if not have_twisted:
111 EXCLUDE.append(pjoin('IPython', 'frontend', 'asyncfrontendbase'))
112 EXCLUDE.append(pjoin('IPython', 'frontend', 'prefilterfrontend'))
113 EXCLUDE.append(pjoin('IPython', 'frontend', 'frontendbase'))
114 EXCLUDE.append(pjoin('IPython', 'frontend', 'linefrontendbase'))
115 EXCLUDE.append(pjoin('IPython', 'frontend', 'tests', 'test_linefrontend'))
116 EXCLUDE.append(pjoin('IPython', 'frontend', 'tests', 'test_frontendbase'))
117 EXCLUDE.append(pjoin('IPython', 'frontend', 'tests',
118 'test_prefilterfrontend'))
119 EXCLUDE.append(pjoin('IPython', 'frontend', 'tests',
120 'test_asyncfrontendbase'))
121 EXCLUDE.append(pjoin('IPython', 'kernel', 'error'))
122 EXCLUDE.append(pjoin('IPython', 'testing', 'parametric'))
123 EXCLUDE.append(pjoin('IPython', 'testing', 'util'))
124 EXCLUDE.append(pjoin('IPython', 'testing', 'tests', 'test_decorators_trial'))
125
126
110 # This is needed for the reg-exp to match on win32 in the ipdoctest plugin.
127 # This is needed for the reg-exp to match on win32 in the ipdoctest plugin.
111 if sys.platform == 'win32':
128 if sys.platform == 'win32':
112 EXCLUDE = [s.replace('\\','\\\\') for s in EXCLUDE]
129 EXCLUDE = [s.replace('\\','\\\\') for s in EXCLUDE]
@@ -232,12 +249,15 b' def make_runners():'
232 'Logger.py', 'macro.py', 'Magic.py', 'OInspect.py',
249 'Logger.py', 'macro.py', 'Magic.py', 'OInspect.py',
233 'OutputTrap.py', 'platutils.py', 'prefilter.py', 'Prompts.py',
250 'OutputTrap.py', 'platutils.py', 'prefilter.py', 'Prompts.py',
234 'PyColorize.py', 'Release.py', 'rlineimpl.py', 'shadowns.py',
251 'PyColorize.py', 'Release.py', 'rlineimpl.py', 'shadowns.py',
235 'shellglobals.py', 'strdispatch.py', 'twshell.py',
252 'shellglobals.py', 'strdispatch.py',
236 'ultraTB.py', 'upgrade_dir.py', 'usage.py', 'wildcard.py',
253 'ultraTB.py', 'upgrade_dir.py', 'usage.py', 'wildcard.py',
237 # See note above for why this is skipped
254 # See note above for why this is skipped
238 # 'Shell.py',
255 # 'Shell.py',
239 'winconsole.py']
256 'winconsole.py']
240
257
258 if have_twisted:
259 top_mod.append('twshell.py')
260
241 if have_pexpect:
261 if have_pexpect:
242 top_mod.append('irunner.py')
262 top_mod.append('irunner.py')
243
263
@@ -43,7 +43,6 b' def doctest_hist_f():'
43 In [10]: tfile = tempfile.mktemp('.py','tmp-ipython-')
43 In [10]: tfile = tempfile.mktemp('.py','tmp-ipython-')
44
44
45 In [11]: %hist -n -f $tfile 3
45 In [11]: %hist -n -f $tfile 3
46
47 """
46 """
48
47
49
48
@@ -2,6 +2,9 b''
2
2
3 XXX - This module is missing proper docs.
3 XXX - This module is missing proper docs.
4 """
4 """
5 # Tell nose to skip this module
6 __test__ = {}
7
5 import sys
8 import sys
6
9
7 from twisted.internet import reactor, threads
10 from twisted.internet import reactor, threads
General Comments 0
You need to be logged in to leave comments. Login now