41
class TestThreadWithException(tests.TestCase):
43
def test_start_and_join_smoke_test(self):
47
tt = test_server.ThreadWithException(target=do_nothing)
51
def test_exception_is_re_raised(self):
52
class MyException(Exception):
55
def raise_my_exception():
58
tt = test_server.ThreadWithException(target=raise_my_exception)
60
self.assertRaises(MyException, tt.join)
62
def test_join_when_no_exception(self):
63
resume = threading.Event()
64
class MyException(Exception):
67
def raise_my_exception():
68
# Wait for the test to tell us to resume
73
tt = test_server.ThreadWithException(target=raise_my_exception)
76
self.assertIs(None, tt.exception)
78
self.assertRaises(MyException, tt.join)
41
81
class TCPClient(object):
43
83
def __init__(self):