~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_thread.py

  • Committer: Vincent Ladeuil
  • Date: 2011-02-08 16:26:23 UTC
  • mto: This revision was merged to the branch mainline in revision 5655.
  • Revision ID: v.ladeuil+lp@free.fr-20110208162623-2njflo8y7rrtek3n
Use clearer names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    )
23
23
 
24
24
 
25
 
class TestThreadWithException(tests.TestCase):
 
25
class TestCatchingExceptionThread(tests.TestCase):
26
26
 
27
27
    def test_start_and_join_smoke_test(self):
28
28
        def do_nothing():
29
29
            pass
30
30
 
31
 
        tt = thread.ThreadWithException(target=do_nothing)
 
31
        tt = thread.CatchingExceptionThread(target=do_nothing)
32
32
        tt.start()
33
33
        tt.join()
34
34
 
39
39
        def raise_my_exception():
40
40
            raise MyException()
41
41
 
42
 
        tt = thread.ThreadWithException(target=raise_my_exception)
 
42
        tt = thread.CatchingExceptionThread(target=raise_my_exception)
43
43
        tt.start()
44
44
        self.assertRaises(MyException, tt.join)
45
45
 
54
54
            # Now we can raise
55
55
            raise MyException()
56
56
 
57
 
        tt = thread.ThreadWithException(target=raise_my_exception)
 
57
        tt = thread.CatchingExceptionThread(target=raise_my_exception)
58
58
        tt.start()
59
59
        tt.join(timeout=0)
60
60
        self.assertIs(None, tt.exception)