Skip to content

Commit

Permalink
Fixed test cases, now they fail as expected.
Browse files Browse the repository at this point in the history
  • Loading branch information
kmerenkov committed May 18, 2010
1 parent e5c553b commit f182ba6
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions tests/server_commands.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
import brukva
import unittest
import sys
from tornado.ioloop import IOLoop


class CustomAssertionError(AssertionError):
io_loop = None

def __init__(self, msg):
super(CustomAssertionError, self).__init__(msg)
def __init__(self, *args, **kwargs):
super(CustomAssertionError, self).__init__(*args, **kwargs)
CustomAssertionError.io_loop.stop()


class TestIOLoop(unittest.TestCase):
class TestIOLoop(IOLoop):
def handle_callback_exception(self, callback):
(type, value, traceback) = sys.exc_info()
raise type, value, traceback


class TornadoTestCase(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(TestIOLoop, self).__init__(*args, **kwargs)
super(TornadoTestCase, self).__init__(*args, **kwargs)
self.failureException = CustomAssertionError

def setUp(self):
self.loop = IOLoop()
self.loop = TestIOLoop()
CustomAssertionError.io_loop = self.loop
self.client = brukva.Client(io_loop=self.loop)
self.client.connection.connect()
Expand Down Expand Up @@ -45,7 +52,7 @@ def start(self):
self.loop.start()


class ServerCommandsTestCase(TestIOLoop):
class ServerCommandsTestCase(TornadoTestCase):
def test_set(self):
self.client.set('foo', 'bar', [self.expect(True), self.finish])
self.start()
Expand Down

0 comments on commit f182ba6

Please sign in to comment.