##// END OF EJS Templates
Fixed bugs in IPython.kernel....
Fixed bugs in IPython.kernel. * Removed :mod:`IPython.kernel.contexts` and :mod:`IPython.kernel.tests.test_contexts` and all code that used them. This was broken and needed to be removed. Also Enthought has a nice decorator that does this. * Fixed broken tests in :file:`test_multienginefc.py` and :file:`test_taskfc.py`. See https://bugs.launchpad.net/ipython/+bug/505358. * Changed ports number in :mod:`IPython.kernel.tests` to 10111 to avoid conflicts with users who are using the older 10105 ports. See https://bugs.launchpad.net/ipython/+bug/504515. * Fixed logic and bugs in :mod:`IPython.kernel.fcutils` and :mod:`IPython.kernel.clientconnector` related to how FURL files are validated and found. See https://bugs.launchpad.net/ipython/+bug/502790. * Fixed the unhandled :class:`DeadReferenceError`` exception that was happening in :mod:`IPython.kernel.multiengineclient' and :mod:`IPython.kernel.taskclient` when the controller died or restarted. Now we capture that error and raises a :class:`IPython.kernel.error.ConnectionError` that has a better error message. See https://bugs.launchpad.net/ipython/+bug/502796.

File last commit:

r1960:51f38f50
r2517:8185e15c
Show More
test_twistedutil.py
50 lines | 1.7 KiB | text/x-python | PythonLexer
Brian Granger
Adding test_twistedutil.py.
r1948 #!/usr/bin/env python
# encoding: utf-8
#-----------------------------------------------------------------------------
# Copyright (C) 2008 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
Brian Granger
Fixing misc testing related things.
r1960 # Tell nose to skip this module
__test__ = {}
Brian Granger
Adding test_twistedutil.py.
r1948 import tempfile
import os, sys
from twisted.internet import reactor
from twisted.trial import unittest
from IPython.kernel.error import FileTimeoutError
from IPython.kernel.twistedutil import wait_for_file
#-----------------------------------------------------------------------------
# Tests
#-----------------------------------------------------------------------------
class TestWaitForFile(unittest.TestCase):
def test_delay(self):
filename = tempfile.mktemp()
def _create_file():
open(filename,'w').write('####')
dcall = reactor.callLater(0.5, _create_file)
d = wait_for_file(filename,delay=0.1)
d.addCallback(lambda r: self.assert_(r))
def _cancel_dcall(r):
if dcall.active():
dcall.cancel()
d.addCallback(_cancel_dcall)
return d
def test_timeout(self):
filename = tempfile.mktemp()
d = wait_for_file(filename,delay=0.1,max_tries=1)
d.addErrback(lambda f: self.assertRaises(FileTimeoutError,f.raiseException))
return d