Show More
@@ -14,12 +14,13 b' __docformat__ = "restructuredtext en"' | |||||
14 | #------------------------------------------------------------------------------- |
|
14 | #------------------------------------------------------------------------------- | |
15 | # Imports |
|
15 | # Imports | |
16 | #------------------------------------------------------------------------------- |
|
16 | #------------------------------------------------------------------------------- | |
17 | from IPython.external import guid |
|
|||
18 |
|
17 | |||
|
18 | from IPython.external import guid | |||
19 |
|
19 | |||
20 | from zope.interface import Interface, Attribute, implements, classProvides |
|
20 | from zope.interface import Interface, Attribute, implements, classProvides | |
21 | from twisted.python.failure import Failure |
|
21 | from twisted.python.failure import Failure | |
22 |
from IPython.frontend.frontendbase import |
|
22 | from IPython.frontend.frontendbase import ( | |
|
23 | FrontEndBase, IFrontEnd, IFrontEndFactory) | |||
23 | from IPython.kernel.core.history import FrontEndHistory |
|
24 | from IPython.kernel.core.history import FrontEndHistory | |
24 | from IPython.kernel.engineservice import IEngineCore |
|
25 | from IPython.kernel.engineservice import IEngineCore | |
25 |
|
26 |
@@ -15,30 +15,38 b' __docformat__ = "restructuredtext en"' | |||||
15 | # Imports |
|
15 | # Imports | |
16 | #--------------------------------------------------------------------------- |
|
16 | #--------------------------------------------------------------------------- | |
17 |
|
17 | |||
|
18 | # Tell nose to skip this module | |||
|
19 | __test__ = {} | |||
|
20 | ||||
|
21 | from twisted.trial import unittest | |||
|
22 | from twisted.internet.defer import succeed | |||
|
23 | ||||
|
24 | from IPython.kernel.core.interpreter import Interpreter | |||
|
25 | import IPython.kernel.engineservice as es | |||
|
26 | ||||
18 | try: |
|
27 | try: | |
19 | from IPython.kernel.core.interpreter import Interpreter |
|
28 | from IPython.frontend.cocoa.cocoa_frontend import IPythonCocoaController | |
20 | import IPython.kernel.engineservice as es |
|
|||
21 | from IPython.testing.util import DeferredTestCase |
|
|||
22 | from twisted.internet.defer import succeed |
|
|||
23 | from IPython.frontend.cocoa.cocoa_frontend import IPythonCocoaController |
|
|||
24 | from Foundation import NSMakeRect |
|
29 | from Foundation import NSMakeRect | |
25 |
from AppKit import NSTextView, NSScrollView |
|
30 | from AppKit import NSTextView, NSScrollView | |
26 | except ImportError: |
|
31 | except ImportError: | |
27 | import nose |
|
32 | # This tells twisted.trial to skip this module if PyObjC is not found | |
28 | raise nose.SkipTest("This test requires zope.interface, Twisted, Foolscap and PyObjC") |
|
33 | skip = True | |
29 |
|
34 | |||
30 | class TestIPythonCocoaControler(DeferredTestCase): |
|
35 | #--------------------------------------------------------------------------- | |
|
36 | # Tests | |||
|
37 | #--------------------------------------------------------------------------- | |||
|
38 | class TestIPythonCocoaControler(unittest.TestCase): | |||
31 | """Tests for IPythonCocoaController""" |
|
39 | """Tests for IPythonCocoaController""" | |
32 |
|
40 | |||
33 | def setUp(self): |
|
41 | def setUp(self): | |
34 | self.controller = IPythonCocoaController.alloc().init() |
|
42 | self.controller = IPythonCocoaController.alloc().init() | |
35 | self.engine = es.EngineService() |
|
43 | self.engine = es.EngineService() | |
36 | self.engine.startService() |
|
44 | self.engine.startService() | |
37 |
|
45 | |||
38 | def tearDown(self): |
|
46 | def tearDown(self): | |
39 | self.controller = None |
|
47 | self.controller = None | |
40 | self.engine.stopService() |
|
48 | self.engine.stopService() | |
41 |
|
49 | |||
42 | def testControllerExecutesCode(self): |
|
50 | def testControllerExecutesCode(self): | |
43 | code ="""5+5""" |
|
51 | code ="""5+5""" | |
44 | expected = Interpreter().execute(code) |
|
52 | expected = Interpreter().execute(code) | |
@@ -47,48 +55,46 b' class TestIPythonCocoaControler(DeferredTestCase):' | |||||
47 | del result['number'] |
|
55 | del result['number'] | |
48 | del result['id'] |
|
56 | del result['id'] | |
49 | return result |
|
57 | return result | |
50 | self.assertDeferredEquals( |
|
58 | d = self.controller.execute(code) | |
51 |
|
|
59 | d.addCallback(removeNumberAndID) | |
52 | expected) |
|
60 | d.addCallback(lambda r: self.assertEquals(r, expected)) | |
53 |
|
61 | |||
54 | def testControllerMirrorsUserNSWithValuesAsStrings(self): |
|
62 | def testControllerMirrorsUserNSWithValuesAsStrings(self): | |
55 | code = """userns1=1;userns2=2""" |
|
63 | code = """userns1=1;userns2=2""" | |
56 | def testControllerUserNS(result): |
|
64 | def testControllerUserNS(result): | |
57 | self.assertEquals(self.controller.userNS['userns1'], 1) |
|
65 | self.assertEquals(self.controller.userNS['userns1'], 1) | |
58 | self.assertEquals(self.controller.userNS['userns2'], 2) |
|
66 | self.assertEquals(self.controller.userNS['userns2'], 2) | |
59 |
|
||||
60 | self.controller.execute(code).addCallback(testControllerUserNS) |
|
67 | self.controller.execute(code).addCallback(testControllerUserNS) | |
61 |
|
68 | |||
62 |
|
||||
63 | def testControllerInstantiatesIEngine(self): |
|
69 | def testControllerInstantiatesIEngine(self): | |
64 | self.assert_(es.IEngineBase.providedBy(self.controller.engine)) |
|
70 | self.assert_(es.IEngineBase.providedBy(self.controller.engine)) | |
65 |
|
71 | |||
66 | def testControllerCompletesToken(self): |
|
72 | def testControllerCompletesToken(self): | |
67 | code = """longNameVariable=10""" |
|
73 | code = """longNameVariable=10""" | |
68 | def testCompletes(result): |
|
74 | def testCompletes(result): | |
69 | self.assert_("longNameVariable" in result) |
|
75 | self.assert_("longNameVariable" in result) | |
70 |
|
76 | |||
71 | def testCompleteToken(result): |
|
77 | def testCompleteToken(result): | |
72 | self.controller.complete("longNa").addCallback(testCompletes) |
|
78 | self.controller.complete("longNa").addCallback(testCompletes) | |
73 |
|
79 | |||
74 | self.controller.execute(code).addCallback(testCompletes) |
|
80 | self.controller.execute(code).addCallback(testCompletes) | |
75 |
|
81 | |||
76 |
|
82 | |||
77 | def testCurrentIndent(self): |
|
83 | def testCurrentIndent(self): | |
78 | """test that current_indent_string returns current indent or None. |
|
84 | """test that current_indent_string returns current indent or None. | |
79 | Uses _indent_for_block for direct unit testing. |
|
85 | Uses _indent_for_block for direct unit testing. | |
80 | """ |
|
86 | """ | |
81 |
|
87 | |||
82 | self.controller.tabUsesSpaces = True |
|
88 | self.controller.tabUsesSpaces = True | |
83 | self.assert_(self.controller._indent_for_block("""a=3""") == None) |
|
89 | self.assert_(self.controller._indent_for_block("""a=3""") == None) | |
84 | self.assert_(self.controller._indent_for_block("") == None) |
|
90 | self.assert_(self.controller._indent_for_block("") == None) | |
85 | block = """def test():\n a=3""" |
|
91 | block = """def test():\n a=3""" | |
86 | self.assert_(self.controller._indent_for_block(block) == \ |
|
92 | self.assert_(self.controller._indent_for_block(block) == \ | |
87 | ' ' * self.controller.tabSpaces) |
|
93 | ' ' * self.controller.tabSpaces) | |
88 |
|
94 | |||
89 | block = """if(True):\n%sif(False):\n%spass""" % \ |
|
95 | block = """if(True):\n%sif(False):\n%spass""" % \ | |
90 | (' '*self.controller.tabSpaces, |
|
96 | (' '*self.controller.tabSpaces, | |
91 | 2*' '*self.controller.tabSpaces) |
|
97 | 2*' '*self.controller.tabSpaces) | |
92 | self.assert_(self.controller._indent_for_block(block) == \ |
|
98 | self.assert_(self.controller._indent_for_block(block) == \ | |
93 | 2*(' '*self.controller.tabSpaces)) |
|
99 | 2*(' '*self.controller.tabSpaces)) | |
94 |
|
100 |
@@ -15,16 +15,14 b' __docformat__ = "restructuredtext en"' | |||||
15 | # Imports |
|
15 | # Imports | |
16 | #--------------------------------------------------------------------------- |
|
16 | #--------------------------------------------------------------------------- | |
17 |
|
17 | |||
|
18 | # Tell nose to skip this module | |||
|
19 | __test__ = {} | |||
18 |
|
20 | |||
19 | try: |
|
21 | from twisted.trial import unittest | |
20 | from twisted.trial import unittest |
|
22 | from IPython.frontend.asyncfrontendbase import AsyncFrontEndBase | |
21 |
|
|
23 | from IPython.frontend import frontendbase | |
22 | from IPython.frontend import frontendbase |
|
24 | from IPython.kernel.engineservice import EngineService | |
23 | from IPython.kernel.engineservice import EngineService |
|
25 | from IPython.testing.parametric import Parametric, parametric | |
24 | from IPython.testing.parametric import Parametric, parametric |
|
|||
25 | except ImportError: |
|
|||
26 | import nose |
|
|||
27 | raise nose.SkipTest("This test requires zope.interface, Twisted and Foolscap") |
|
|||
28 |
|
26 | |||
29 |
|
27 | |||
30 | class FrontEndCallbackChecker(AsyncFrontEndBase): |
|
28 | class FrontEndCallbackChecker(AsyncFrontEndBase): |
@@ -5,12 +5,12 b' Test process execution and IO redirection.' | |||||
5 |
|
5 | |||
6 | __docformat__ = "restructuredtext en" |
|
6 | __docformat__ = "restructuredtext en" | |
7 |
|
7 | |||
8 |
#----------------------------------------------------------------------------- |
|
8 | #----------------------------------------------------------------------------- | |
9 | # Copyright (C) 2008 The IPython Development Team |
|
9 | # Copyright (C) 2008-2009 The IPython Development Team | |
10 | # |
|
10 | # | |
11 | # Distributed under the terms of the BSD License. The full license is |
|
11 | # Distributed under the terms of the BSD License. The full license is | |
12 | # in the file COPYING, distributed as part of this software. |
|
12 | # in the file COPYING, distributed as part of this software. | |
13 |
#----------------------------------------------------------------------------- |
|
13 | #----------------------------------------------------------------------------- | |
14 |
|
14 | |||
15 | from cStringIO import StringIO |
|
15 | from cStringIO import StringIO | |
16 | from time import sleep |
|
16 | from time import sleep |
@@ -22,6 +22,9 b' from IPython.kernel.core.interpreter import Interpreter' | |||||
22 | # Tests |
|
22 | # Tests | |
23 | #----------------------------------------------------------------------------- |
|
23 | #----------------------------------------------------------------------------- | |
24 |
|
24 | |||
|
25 | # Tell nose to skip this module | |||
|
26 | __test__ = {} | |||
|
27 | ||||
25 | class TestInterpreter(unittest.TestCase): |
|
28 | class TestInterpreter(unittest.TestCase): | |
26 |
|
29 | |||
27 | def test_unicode(self): |
|
30 | def test_unicode(self): |
@@ -15,6 +15,9 b' __docformat__ = "restructuredtext en"' | |||||
15 | # Imports |
|
15 | # Imports | |
16 | #----------------------------------------------------------------------------- |
|
16 | #----------------------------------------------------------------------------- | |
17 |
|
17 | |||
|
18 | # Tell nose to skip this module | |||
|
19 | __test__ = {} | |||
|
20 | ||||
18 | import unittest |
|
21 | import unittest | |
19 | import IPython.kernel.core.notification as notification |
|
22 | import IPython.kernel.core.notification as notification | |
20 | from nose.tools import timed |
|
23 | from nose.tools import timed |
@@ -12,12 +12,12 b' __docformat__ = "restructuredtext en"' | |||||
12 | # in the file COPYING, distributed as part of this software. |
|
12 | # in the file COPYING, distributed as part of this software. | |
13 | #------------------------------------------------------------------------------- |
|
13 | #------------------------------------------------------------------------------- | |
14 |
|
14 | |||
|
15 | # Tell nose to skip this module | |||
|
16 | __test__ = {} | |||
15 |
|
17 | |||
16 | # Stdlib imports |
|
|||
17 | import os |
|
18 | import os | |
18 | from cStringIO import StringIO |
|
19 | from cStringIO import StringIO | |
19 |
|
20 | |||
20 | # Our own imports |
|
|||
21 | from IPython.testing import decorators as dec |
|
21 | from IPython.testing import decorators as dec | |
22 |
|
22 | |||
23 | #----------------------------------------------------------------------------- |
|
23 | #----------------------------------------------------------------------------- |
@@ -268,6 +268,8 b' def _formatTracebackLines(lnum, index, lines, Colors, lvals=None,scheme=None):' | |||||
268 | # This lets us get fully syntax-highlighted tracebacks. |
|
268 | # This lets us get fully syntax-highlighted tracebacks. | |
269 | if scheme is None: |
|
269 | if scheme is None: | |
270 | try: |
|
270 | try: | |
|
271 | # Again, reference to a global __IPYTHON__ that doesn't exist. | |||
|
272 | # XXX | |||
271 | scheme = __IPYTHON__.rc.colors |
|
273 | scheme = __IPYTHON__.rc.colors | |
272 | except: |
|
274 | except: | |
273 | scheme = DEFAULT_SCHEME |
|
275 | scheme = DEFAULT_SCHEME | |
@@ -489,7 +491,7 b' class ListTB(TBTools):' | |||||
489 |
|
491 | |||
490 | # This is being commented out for now as the __IPYTHON__ variable |
|
492 | # This is being commented out for now as the __IPYTHON__ variable | |
491 | # referenced here is not resolved and causes massive test failures |
|
493 | # referenced here is not resolved and causes massive test failures | |
492 | # and errors. B. Granger, 04/2009. |
|
494 | # and errors. B. Granger, 04/2009. XXX | |
493 | # See https://bugs.launchpad.net/bugs/362137 |
|
495 | # See https://bugs.launchpad.net/bugs/362137 | |
494 | # # vds:>> |
|
496 | # # vds:>> | |
495 | # if have_filedata: |
|
497 | # if have_filedata: | |
@@ -810,7 +812,7 b' class VerboseTB(TBTools):' | |||||
810 |
|
812 | |||
811 | # This is being commented out for now as the __IPYTHON__ variable |
|
813 | # This is being commented out for now as the __IPYTHON__ variable | |
812 | # referenced here is not resolved and causes massive test failures |
|
814 | # referenced here is not resolved and causes massive test failures | |
813 | # and errors. B. Granger, 04/2009. |
|
815 | # and errors. B. Granger, 04/2009. XXX | |
814 | # See https://bugs.launchpad.net/bugs/362137 |
|
816 | # See https://bugs.launchpad.net/bugs/362137 | |
815 | # # vds: >> |
|
817 | # # vds: >> | |
816 | # if records: |
|
818 | # if records: |
@@ -29,8 +29,12 b' from twisted.python import failure, log' | |||||
29 |
|
29 | |||
30 | from IPython.external import argparse |
|
30 | from IPython.external import argparse | |
31 | from IPython.external import Itpl |
|
31 | from IPython.external import Itpl | |
32 | from IPython.genutils import get_ipython_dir, get_log_dir, get_security_dir |
|
32 | from IPython.genutils import ( | |
33 | from IPython.genutils import num_cpus |
|
33 | get_ipython_dir, | |
|
34 | get_log_dir, | |||
|
35 | get_security_dir, | |||
|
36 | num_cpus | |||
|
37 | ) | |||
34 | from IPython.kernel.fcutil import have_crypto |
|
38 | from IPython.kernel.fcutil import have_crypto | |
35 |
|
39 | |||
36 | # Create various ipython directories if they don't exist. |
|
40 | # Create various ipython directories if they don't exist. | |
@@ -485,6 +489,7 b' class SSHEngineSet(object):' | |||||
485 |
|
489 | |||
486 |
|
490 | |||
487 | def check_security(args, cont_args): |
|
491 | def check_security(args, cont_args): | |
|
492 | """Check to see if we should run with SSL support.""" | |||
488 | if (not args.x or not args.y) and not have_crypto: |
|
493 | if (not args.x or not args.y) and not have_crypto: | |
489 | log.err(""" |
|
494 | log.err(""" | |
490 | OpenSSL/pyOpenSSL is not available, so we can't run in secure mode. |
|
495 | OpenSSL/pyOpenSSL is not available, so we can't run in secure mode. | |
@@ -499,6 +504,7 b' Try running ipcluster with the -xy flags: ipcluster local -xy -n 4""")' | |||||
499 |
|
504 | |||
500 |
|
505 | |||
501 | def check_reuse(args, cont_args): |
|
506 | def check_reuse(args, cont_args): | |
|
507 | """Check to see if we should try to resuse FURL files.""" | |||
502 | if args.r: |
|
508 | if args.r: | |
503 | cont_args.append('-r') |
|
509 | cont_args.append('-r') | |
504 | if args.client_port == 0 or args.engine_port == 0: |
|
510 | if args.client_port == 0 or args.engine_port == 0: | |
@@ -513,11 +519,13 b' the --client-port and --engine-port options.""")' | |||||
513 |
|
519 | |||
514 |
|
520 | |||
515 | def _err_and_stop(f): |
|
521 | def _err_and_stop(f): | |
|
522 | """Errback to log a failure and halt the reactor on a fatal error.""" | |||
516 | log.err(f) |
|
523 | log.err(f) | |
517 | reactor.stop() |
|
524 | reactor.stop() | |
518 |
|
525 | |||
519 |
|
526 | |||
520 | def _delay_start(cont_pid, start_engines, furl_file, reuse): |
|
527 | def _delay_start(cont_pid, start_engines, furl_file, reuse): | |
|
528 | """Wait for controller to create FURL files and the start the engines.""" | |||
521 | if not reuse: |
|
529 | if not reuse: | |
522 | if os.path.isfile(furl_file): |
|
530 | if os.path.isfile(furl_file): | |
523 | os.unlink(furl_file) |
|
531 | os.unlink(furl_file) | |
@@ -728,8 +736,11 b' def get_args():' | |||||
728 |
|
736 | |||
729 | parser = argparse.ArgumentParser( |
|
737 | parser = argparse.ArgumentParser( | |
730 | description='IPython cluster startup. This starts a controller and\ |
|
738 | description='IPython cluster startup. This starts a controller and\ | |
731 |
engines using various approaches. |
|
739 | engines using various approaches. Use the IPYTHONDIR environment\ | |
732 | THE API WILL CHANGE SIGNIFICANTLY BEFORE THE FINAL RELEASE.' |
|
740 | variable to change your IPython directory from the default of\ | |
|
741 | .ipython or _ipython. The log and security subdirectories of your\ | |||
|
742 | IPython directory will be used by this script for log files and\ | |||
|
743 | security files.' | |||
733 | ) |
|
744 | ) | |
734 | subparsers = parser.add_subparsers( |
|
745 | subparsers = parser.add_subparsers( | |
735 | help='available cluster types. For help, do "ipcluster TYPE --help"') |
|
746 | help='available cluster types. For help, do "ipcluster TYPE --help"') |
@@ -21,9 +21,10 b' __docformat__ = "restructuredtext en"' | |||||
21 | import sys |
|
21 | import sys | |
22 | sys.path.insert(0, '') |
|
22 | sys.path.insert(0, '') | |
23 |
|
23 | |||
24 | import sys, time, os |
|
|||
25 | import tempfile |
|
|||
26 | from optparse import OptionParser |
|
24 | from optparse import OptionParser | |
|
25 | import os | |||
|
26 | import time | |||
|
27 | import tempfile | |||
27 |
|
28 | |||
28 | from twisted.application import internet, service |
|
29 | from twisted.application import internet, service | |
29 | from twisted.internet import reactor, error, defer |
|
30 | from twisted.internet import reactor, error, defer | |
@@ -263,7 +264,14 b' def init_config():' | |||||
263 | Initialize the configuration using default and command line options. |
|
264 | Initialize the configuration using default and command line options. | |
264 | """ |
|
265 | """ | |
265 |
|
266 | |||
266 |
parser = OptionParser( |
|
267 | parser = OptionParser("""ipcontroller [options] | |
|
268 | ||||
|
269 | Start an IPython controller. | |||
|
270 | ||||
|
271 | Use the IPYTHONDIR environment variable to change your IPython directory | |||
|
272 | from the default of .ipython or _ipython. The log and security | |||
|
273 | subdirectories of your IPython directory will be used by this script | |||
|
274 | for log files and security files.""") | |||
267 |
|
275 | |||
268 | # Client related options |
|
276 | # Client related options | |
269 | parser.add_option( |
|
277 | parser.add_option( |
@@ -21,8 +21,8 b' __docformat__ = "restructuredtext en"' | |||||
21 | import sys |
|
21 | import sys | |
22 | sys.path.insert(0, '') |
|
22 | sys.path.insert(0, '') | |
23 |
|
23 | |||
24 | import sys, os |
|
|||
25 | from optparse import OptionParser |
|
24 | from optparse import OptionParser | |
|
25 | import os | |||
26 |
|
26 | |||
27 | from twisted.application import service |
|
27 | from twisted.application import service | |
28 | from twisted.internet import reactor |
|
28 | from twisted.internet import reactor | |
@@ -140,7 +140,14 b' def init_config():' | |||||
140 | Initialize the configuration using default and command line options. |
|
140 | Initialize the configuration using default and command line options. | |
141 | """ |
|
141 | """ | |
142 |
|
142 | |||
143 |
parser = OptionParser( |
|
143 | parser = OptionParser("""ipengine [options] | |
|
144 | ||||
|
145 | Start an IPython engine. | |||
|
146 | ||||
|
147 | Use the IPYTHONDIR environment variable to change your IPython directory | |||
|
148 | from the default of .ipython or _ipython. The log and security | |||
|
149 | subdirectories of your IPython directory will be used by this script | |||
|
150 | for log files and security files.""") | |||
144 |
|
151 | |||
145 | parser.add_option( |
|
152 | parser.add_option( | |
146 | "--furl-file", |
|
153 | "--furl-file", |
@@ -1,3 +1,6 b'' | |||||
|
1 | # Tell nose to skip this module | |||
|
2 | __test__ = {} | |||
|
3 | ||||
1 | #from __future__ import with_statement |
|
4 | #from __future__ import with_statement | |
2 |
|
5 | |||
3 | # XXX This file is currently disabled to preserve 2.4 compatibility. |
|
6 | # XXX This file is currently disabled to preserve 2.4 compatibility. |
@@ -23,15 +23,15 b' __docformat__ = "restructuredtext en"' | |||||
23 | # Imports |
|
23 | # Imports | |
24 | #------------------------------------------------------------------------------- |
|
24 | #------------------------------------------------------------------------------- | |
25 |
|
25 | |||
26 | try: |
|
26 | # Tell nose to skip this module | |
27 | from twisted.application.service import IService |
|
27 | __test__ = {} | |
28 | from IPython.kernel.controllerservice import ControllerService |
|
28 | ||
29 | from IPython.kernel.tests import multienginetest as met |
|
29 | from twisted.application.service import IService | |
30 |
|
|
30 | from IPython.kernel.controllerservice import ControllerService | |
31 |
|
|
31 | from IPython.kernel.tests import multienginetest as met | |
32 | except ImportError: |
|
32 | from controllertest import IControllerCoreTestCase | |
33 | import nose |
|
33 | from IPython.testing.util import DeferredTestCase | |
34 | raise nose.SkipTest("This test requires zope.interface, Twisted and Foolscap") |
|
34 | ||
35 |
|
35 | |||
36 | class BasicControllerServiceTest(DeferredTestCase, |
|
36 | class BasicControllerServiceTest(DeferredTestCase, | |
37 | IControllerCoreTestCase): |
|
37 | IControllerCoreTestCase): |
@@ -15,30 +15,29 b' __docformat__ = "restructuredtext en"' | |||||
15 | # Imports |
|
15 | # Imports | |
16 | #------------------------------------------------------------------------------- |
|
16 | #------------------------------------------------------------------------------- | |
17 |
|
17 | |||
18 | try: |
|
18 | # Tell nose to skip this module | |
19 | from twisted.python import components |
|
19 | __test__ = {} | |
20 | from twisted.internet import reactor, defer |
|
|||
21 | from twisted.spread import pb |
|
|||
22 | from twisted.internet.base import DelayedCall |
|
|||
23 | DelayedCall.debug = True |
|
|||
24 |
|
20 | |||
25 | import zope.interface as zi |
|
21 | from twisted.python import components | |
|
22 | from twisted.internet import reactor, defer | |||
|
23 | from twisted.spread import pb | |||
|
24 | from twisted.internet.base import DelayedCall | |||
|
25 | DelayedCall.debug = True | |||
26 |
|
26 | |||
27 | from IPython.kernel.fcutil import Tub, UnauthenticatedTub |
|
27 | import zope.interface as zi | |
28 | from IPython.kernel import engineservice as es |
|
28 | ||
29 | from IPython.testing.util import DeferredTestCase |
|
29 | from IPython.kernel.fcutil import Tub, UnauthenticatedTub | |
30 |
|
|
30 | from IPython.kernel import engineservice as es | |
31 | from IPython.kernel.enginefc import FCRemoteEngineRefFromService, IEngineBase |
|
31 | from IPython.testing.util import DeferredTestCase | |
32 |
|
|
32 | from IPython.kernel.controllerservice import IControllerBase | |
33 |
|
|
33 | from IPython.kernel.enginefc import FCRemoteEngineRefFromService, IEngineBase | |
34 |
|
34 | from IPython.kernel.engineservice import IEngineQueued | ||
35 |
|
|
35 | from IPython.kernel.engineconnector import EngineConnector | |
36 | IEngineCoreTestCase, \ |
|
36 | ||
37 | IEngineSerializedTestCase, \ |
|
37 | from IPython.kernel.tests.engineservicetest import \ | |
38 |
|
|
38 | IEngineCoreTestCase, \ | |
39 | except ImportError: |
|
39 | IEngineSerializedTestCase, \ | |
40 | import nose |
|
40 | IEngineQueuedTestCase | |
41 | raise nose.SkipTest("This test requires zope.interface, Twisted and Foolscap") |
|
|||
42 |
|
41 | |||
43 |
|
42 | |||
44 | class EngineFCTest(DeferredTestCase, |
|
43 | class EngineFCTest(DeferredTestCase, |
@@ -23,20 +23,19 b' __docformat__ = "restructuredtext en"' | |||||
23 | # Imports |
|
23 | # Imports | |
24 | #------------------------------------------------------------------------------- |
|
24 | #------------------------------------------------------------------------------- | |
25 |
|
25 | |||
26 | try: |
|
26 | # Tell nose to skip this module | |
27 | from twisted.internet import defer |
|
27 | __test__ = {} | |
28 | from twisted.application.service import IService |
|
28 | ||
29 |
|
29 | from twisted.internet import defer | ||
30 | from IPython.kernel import engineservice as es |
|
30 | from twisted.application.service import IService | |
31 | from IPython.testing.util import DeferredTestCase |
|
31 | ||
32 |
|
|
32 | from IPython.kernel import engineservice as es | |
33 | IEngineCoreTestCase, \ |
|
33 | from IPython.testing.util import DeferredTestCase | |
34 | IEngineSerializedTestCase, \ |
|
34 | from IPython.kernel.tests.engineservicetest import \ | |
35 |
|
|
35 | IEngineCoreTestCase, \ | |
36 |
|
|
36 | IEngineSerializedTestCase, \ | |
37 | except ImportError: |
|
37 | IEngineQueuedTestCase, \ | |
38 | import nose |
|
38 | IEnginePropertiesTestCase | |
39 | raise nose.SkipTest("This test requires zope.interface, Twisted and Foolscap") |
|
|||
40 |
|
39 | |||
41 |
|
40 | |||
42 | class BasicEngineServiceTest(DeferredTestCase, |
|
41 | class BasicEngineServiceTest(DeferredTestCase, |
@@ -15,18 +15,17 b' __docformat__ = "restructuredtext en"' | |||||
15 | # Imports |
|
15 | # Imports | |
16 | #----------------------------------------------------------------------------- |
|
16 | #----------------------------------------------------------------------------- | |
17 |
|
17 | |||
18 | try: |
|
18 | # Tell nose to skip this module | |
19 | from twisted.internet import defer |
|
19 | __test__ = {} | |
20 | from IPython.testing.util import DeferredTestCase |
|
20 | ||
21 | from IPython.kernel.controllerservice import ControllerService |
|
21 | from twisted.internet import defer | |
22 | from IPython.kernel import multiengine as me |
|
22 | from IPython.testing.util import DeferredTestCase | |
23 | from IPython.kernel.tests.multienginetest import (IMultiEngineTestCase, |
|
23 | from IPython.kernel.controllerservice import ControllerService | |
24 | ISynchronousMultiEngineTestCase) |
|
24 | from IPython.kernel import multiengine as me | |
25 | except ImportError: |
|
25 | from IPython.kernel.tests.multienginetest import (IMultiEngineTestCase, | |
26 | import nose |
|
26 | ISynchronousMultiEngineTestCase) | |
27 | raise nose.SkipTest("This test requires zope.interface, Twisted and Foolscap") |
|
27 | ||
28 |
|
28 | |||
29 |
|
||||
30 | class BasicMultiEngineTestCase(DeferredTestCase, IMultiEngineTestCase): |
|
29 | class BasicMultiEngineTestCase(DeferredTestCase, IMultiEngineTestCase): | |
31 |
|
30 | |||
32 | def setUp(self): |
|
31 | def setUp(self): |
@@ -14,25 +14,25 b' __docformat__ = "restructuredtext en"' | |||||
14 | # Imports |
|
14 | # Imports | |
15 | #------------------------------------------------------------------------------- |
|
15 | #------------------------------------------------------------------------------- | |
16 |
|
16 | |||
17 | try: |
|
17 | # Tell nose to skip this module | |
18 | from twisted.internet import defer, reactor |
|
18 | __test__ = {} | |
|
19 | ||||
|
20 | from twisted.internet import defer, reactor | |||
|
21 | ||||
|
22 | from IPython.kernel.fcutil import Tub, UnauthenticatedTub | |||
|
23 | ||||
|
24 | from IPython.testing.util import DeferredTestCase | |||
|
25 | from IPython.kernel.controllerservice import ControllerService | |||
|
26 | from IPython.kernel.multiengine import IMultiEngine | |||
|
27 | from IPython.kernel.tests.multienginetest import IFullSynchronousMultiEngineTestCase | |||
|
28 | from IPython.kernel.multienginefc import IFCSynchronousMultiEngine | |||
|
29 | from IPython.kernel import multiengine as me | |||
|
30 | from IPython.kernel.clientconnector import ClientConnector | |||
|
31 | from IPython.kernel.parallelfunction import ParallelFunction | |||
|
32 | from IPython.kernel.error import CompositeError | |||
|
33 | from IPython.kernel.util import printer | |||
19 |
|
34 | |||
20 | from IPython.kernel.fcutil import Tub, UnauthenticatedTub |
|
|||
21 |
|
35 | |||
22 | from IPython.testing.util import DeferredTestCase |
|
|||
23 | from IPython.kernel.controllerservice import ControllerService |
|
|||
24 | from IPython.kernel.multiengine import IMultiEngine |
|
|||
25 | from IPython.kernel.tests.multienginetest import IFullSynchronousMultiEngineTestCase |
|
|||
26 | from IPython.kernel.multienginefc import IFCSynchronousMultiEngine |
|
|||
27 | from IPython.kernel import multiengine as me |
|
|||
28 | from IPython.kernel.clientconnector import ClientConnector |
|
|||
29 | from IPython.kernel.parallelfunction import ParallelFunction |
|
|||
30 | from IPython.kernel.error import CompositeError |
|
|||
31 | from IPython.kernel.util import printer |
|
|||
32 | except ImportError: |
|
|||
33 | import nose |
|
|||
34 | raise nose.SkipTest("This test requires zope.interface, Twisted and Foolscap") |
|
|||
35 |
|
||||
36 | def _raise_it(f): |
|
36 | def _raise_it(f): | |
37 | try: |
|
37 | try: | |
38 | f.raiseException() |
|
38 | f.raiseException() |
@@ -15,21 +15,21 b' __docformat__ = "restructuredtext en"' | |||||
15 | # Imports |
|
15 | # Imports | |
16 | #----------------------------------------------------------------------------- |
|
16 | #----------------------------------------------------------------------------- | |
17 |
|
17 | |||
18 | try: |
|
18 | # Tell nose to skip this module | |
19 | import zope.interface as zi |
|
19 | __test__ = {} | |
20 | from twisted.trial import unittest |
|
20 | ||
21 | from IPython.testing.util import DeferredTestCase |
|
21 | import zope.interface as zi | |
|
22 | from twisted.trial import unittest | |||
|
23 | from IPython.testing.util import DeferredTestCase | |||
|
24 | ||||
|
25 | from IPython.kernel.newserialized import \ | |||
|
26 | ISerialized, \ | |||
|
27 | IUnSerialized, \ | |||
|
28 | Serialized, \ | |||
|
29 | UnSerialized, \ | |||
|
30 | SerializeIt, \ | |||
|
31 | UnSerializeIt | |||
22 |
|
32 | |||
23 | from IPython.kernel.newserialized import \ |
|
|||
24 | ISerialized, \ |
|
|||
25 | IUnSerialized, \ |
|
|||
26 | Serialized, \ |
|
|||
27 | UnSerialized, \ |
|
|||
28 | SerializeIt, \ |
|
|||
29 | UnSerializeIt |
|
|||
30 | except ImportError: |
|
|||
31 | import nose |
|
|||
32 | raise nose.SkipTest("This test requires zope.interface, Twisted and Foolscap") |
|
|||
33 |
|
33 | |||
34 | #----------------------------------------------------------------------------- |
|
34 | #----------------------------------------------------------------------------- | |
35 | # Tests |
|
35 | # Tests |
@@ -16,18 +16,18 b' __docformat__ = "restructuredtext en"' | |||||
16 | # Imports |
|
16 | # Imports | |
17 | #------------------------------------------------------------------------------- |
|
17 | #------------------------------------------------------------------------------- | |
18 |
|
18 | |||
19 | try: |
|
19 | # Tell nose to skip this module | |
20 | from twisted.internet import defer |
|
20 | __test__ = {} | |
21 | from twisted.python import failure |
|
21 | ||
22 |
|
22 | from twisted.internet import defer | ||
23 | from IPython.testing.util import DeferredTestCase |
|
23 | from twisted.python import failure | |
24 | import IPython.kernel.pendingdeferred as pd |
|
24 | ||
25 |
|
|
25 | from IPython.testing.util import DeferredTestCase | |
26 | from IPython.kernel.util import printer |
|
26 | import IPython.kernel.pendingdeferred as pd | |
27 | except ImportError: |
|
27 | from IPython.kernel import error | |
28 | import nose |
|
28 | from IPython.kernel.util import printer | |
29 | raise nose.SkipTest("This test requires zope.interface, Twisted and Foolscap") |
|
29 | ||
30 |
|
30 | |||
31 | class Foo(object): |
|
31 | class Foo(object): | |
32 |
|
32 | |||
33 | def bar(self, bahz): |
|
33 | def bar(self, bahz): |
@@ -15,19 +15,19 b' __docformat__ = "restructuredtext en"' | |||||
15 | # Imports |
|
15 | # Imports | |
16 | #------------------------------------------------------------------------------- |
|
16 | #------------------------------------------------------------------------------- | |
17 |
|
17 | |||
18 | try: |
|
18 | # Tell nose to skip this module | |
19 | import time |
|
19 | __test__ = {} | |
20 |
|
20 | |||
21 | from twisted.internet import defer |
|
21 | import time | |
22 | from twisted.trial import unittest |
|
22 | ||
23 |
|
23 | from twisted.internet import defer | ||
24 | from IPython.kernel import task, controllerservice as cs, engineservice as es |
|
24 | from twisted.trial import unittest | |
25 | from IPython.kernel.multiengine import IMultiEngine |
|
25 | ||
26 | from IPython.testing.util import DeferredTestCase |
|
26 | from IPython.kernel import task, controllerservice as cs, engineservice as es | |
27 | from IPython.kernel.tests.tasktest import ITaskControllerTestCase |
|
27 | from IPython.kernel.multiengine import IMultiEngine | |
28 | except ImportError: |
|
28 | from IPython.testing.util import DeferredTestCase | |
29 | import nose |
|
29 | from IPython.kernel.tests.tasktest import ITaskControllerTestCase | |
30 | raise nose.SkipTest("This test requires zope.interface, Twisted and Foolscap") |
|
30 | ||
31 |
|
31 | |||
32 | #------------------------------------------------------------------------------- |
|
32 | #------------------------------------------------------------------------------- | |
33 | # Tests |
|
33 | # Tests |
@@ -14,27 +14,26 b' __docformat__ = "restructuredtext en"' | |||||
14 | # Imports |
|
14 | # Imports | |
15 | #------------------------------------------------------------------------------- |
|
15 | #------------------------------------------------------------------------------- | |
16 |
|
16 | |||
17 | try: |
|
17 | # Tell nose to skip this module | |
18 | import time |
|
18 | __test__ = {} | |
19 |
|
19 | |||
20 | from twisted.internet import defer, reactor |
|
20 | import time | |
21 |
|
21 | |||
22 | from IPython.kernel.fcutil import Tub, UnauthenticatedTub |
|
22 | from twisted.internet import defer, reactor | |
23 |
|
23 | |||
24 |
|
|
24 | from IPython.kernel.fcutil import Tub, UnauthenticatedTub | |
25 | from IPython.kernel import controllerservice as cs |
|
25 | ||
26 | import IPython.kernel.multiengine as me |
|
26 | from IPython.kernel import task as taskmodule | |
27 | from IPython.testing.util import DeferredTestCase |
|
27 | from IPython.kernel import controllerservice as cs | |
28 | from IPython.kernel.multienginefc import IFCSynchronousMultiEngine |
|
28 | import IPython.kernel.multiengine as me | |
29 | from IPython.kernel.taskfc import IFCTaskController |
|
29 | from IPython.testing.util import DeferredTestCase | |
30 |
|
|
30 | from IPython.kernel.multienginefc import IFCSynchronousMultiEngine | |
31 |
|
|
31 | from IPython.kernel.taskfc import IFCTaskController | |
32 |
|
|
32 | from IPython.kernel.util import printer | |
33 |
|
|
33 | from IPython.kernel.tests.tasktest import ITaskControllerTestCase | |
34 |
|
|
34 | from IPython.kernel.clientconnector import ClientConnector | |
35 | except ImportError: |
|
35 | from IPython.kernel.error import CompositeError | |
36 | import nose |
|
36 | from IPython.kernel.parallelfunction import ParallelFunction | |
37 | raise nose.SkipTest("This test requires zope.interface, Twisted and Foolscap") |
|
|||
38 |
|
37 | |||
39 |
|
38 | |||
40 | #------------------------------------------------------------------------------- |
|
39 | #------------------------------------------------------------------------------- |
@@ -12,6 +12,9 b'' | |||||
12 | # Imports |
|
12 | # Imports | |
13 | #----------------------------------------------------------------------------- |
|
13 | #----------------------------------------------------------------------------- | |
14 |
|
14 | |||
|
15 | # Tell nose to skip this module | |||
|
16 | __test__ = {} | |||
|
17 | ||||
15 | import tempfile |
|
18 | import tempfile | |
16 | import os, sys |
|
19 | import os, sys | |
17 |
|
20 |
@@ -123,10 +123,10 b' def skipif(skip_condition, msg=None):' | |||||
123 | Parameters |
|
123 | Parameters | |
124 | ---------- |
|
124 | ---------- | |
125 | skip_condition : bool or callable. |
|
125 | skip_condition : bool or callable. | |
126 |
|
|
126 | Flag to determine whether to skip test. If the condition is a | |
127 |
|
|
127 | callable, it is used at runtime to dynamically make the decision. This | |
128 |
|
|
128 | is useful for tests that may require costly imports, to delay the cost | |
129 |
|
|
129 | until the test suite is actually executed. | |
130 | msg : string |
|
130 | msg : string | |
131 | Message to give on raising a SkipTest exception |
|
131 | Message to give on raising a SkipTest exception | |
132 |
|
132 |
@@ -309,7 +309,7 b' you want to unlock the door and enter your house. As with your house, you want' | |||||
309 | to be able to create the key (or FURL file) once, and then simply use it at |
|
309 | to be able to create the key (or FURL file) once, and then simply use it at | |
310 | any point in the future. |
|
310 | any point in the future. | |
311 |
|
311 | |||
312 |
This is possible |
|
312 | This is possible, but before you do this, you **must** remove any old FURL | |
313 | files in the :file:`~/.ipython/security` directory. |
|
313 | files in the :file:`~/.ipython/security` directory. | |
314 |
|
314 | |||
315 | .. warning:: |
|
315 | .. warning:: |
General Comments 0
You need to be logged in to leave comments.
Login now