from pyvows import Vows, expect
from threading import Thread
from time import sleep
class MyThread(Thread):
def __init__(self, a, b, done):
super(MyThread, self).__init__()
self.a = a
self.b = b
self.done = done
def run(self):
while True:
sleep(2)
self.done(self.a+self.b)
break
def sum_in_thread(a, b, callback):
t = MyThread(a, b, callback)
t.start()
def sum(a, b, callback):
callback(a+b)
@Vows.batch
class ThreadContext(Vows.Context):
@Vows.async_topic
def topic(self, callback):
sum_in_thread(2,2, callback)
#sum(2,2, callback)
def should_equal_to_4(self, topic):
expect(topic[0]).to_equal(4)
It passed but with 0 honored. Is it possible to test this case?
I tried to test following:
It passed but with 0 honored. Is it possible to test this case?