Browse Source

Test cleanup

Michal 'vorner' Vaner 14 years ago
parent
commit
6ed7ca08bb
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/bin/msgq/tests/msgq_test.py

+ 6 - 4
src/bin/msgq/tests/msgq_test.py

@@ -111,8 +111,6 @@ class TestSubscriptionManager(unittest.TestCase):
         msgq = MsgQ("/does/not/exist")
         self.assertRaises(socket.error, msgq.setup)
 
-class TestPassed(Exception): pass
-
 class SendNonblock(unittest.TestCase):
     """
     Tests that the whole thing will not get blocked if someone does not read.
@@ -154,7 +152,7 @@ class SendNonblock(unittest.TestCase):
         try:
             while True:
                 sender(msgq, write)
-        except (socket.error, TestPassed):
+        except socket.error:
             pass
 
     def test_infinite_sendmsg(self):
@@ -193,6 +191,10 @@ class SendNonblock(unittest.TestCase):
                 msgq.register_socket(queue)
                 msgq.run()
             else:
+                def killall(signum, frame):
+                    os.kill(queue_pid, signal.SIGTERM)
+                    sys.exit(1)
+                signal.signal(signal.SIGALRM, killall)
                 msg = msgq.preparemsg({"type" : "ping"}, {"data" : data})
                 now = time.clock()
                 while time.clock() - now < 0.2:
@@ -207,7 +209,7 @@ class SendNonblock(unittest.TestCase):
         """
         Tests sending small data many times.
         """
-        self.send_many("")
+        self.send_many("data")
 
     def test_large_sends(self):
         """