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