~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_cethread.py

  • Committer: Jonathan Riddell
  • Date: 2011-05-16 11:27:37 UTC
  • mto: This revision was merged to the branch mainline in revision 5869.
  • Revision ID: jriddell@canonical.com-20110516112737-gep642p24rtzp3jt
userĀ guideĀ licence

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2011, 2016 Canonical Ltd
 
1
# Copyright (C) 2010, 2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
81
81
        self.assertIs(in_thread, tt.sync_event)
82
82
        control.set()
83
83
        self.assertRaises(MyException, tt.join)
84
 
        self.assertEqual(True, tt.sync_event.isSet())
 
84
        self.assertEquals(True, tt.sync_event.isSet())
85
85
 
86
86
    def test_switch_and_set(self):
87
87
        """Caller can precisely control a thread."""
111
111
 
112
112
        tt = TestThread()
113
113
        tt.start()
114
 
        self.assertEqual('starting', tt.current_step)
 
114
        self.assertEquals('starting', tt.current_step)
115
115
        control1.set()
116
116
        tt.step1.wait()
117
 
        self.assertEqual('step1', tt.current_step)
 
117
        self.assertEquals('step1', tt.current_step)
118
118
        control2.set()
119
119
        tt.step2.wait()
120
 
        self.assertEqual('step2', tt.current_step)
 
120
        self.assertEquals('step2', tt.current_step)
121
121
        control3.set()
122
122
        # We don't wait on tt.final
123
123
        tt.join()
124
 
        self.assertEqual('done', tt.current_step)
 
124
        self.assertEquals('done', tt.current_step)
125
125
 
126
126
    def test_exception_while_switch_and_set(self):
127
127
        control1 = threading.Event()
152
152
 
153
153
        tt = TestThread()
154
154
        tt.start()
155
 
        self.assertEqual('starting', tt.current_step)
 
155
        self.assertEquals('starting', tt.current_step)
156
156
        control1.set()
157
157
        # We now wait on step1 which will be set when catching the exception
158
158
        tt.step1.wait()