~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-10 11:57:45 UTC
  • mto: This revision was merged to the branch mainline in revision 5661.
  • Revision ID: v.ladeuil+lp@free.fr-20110210115745-iskdyofe9b64iz47
Align method name and implementation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
        self.assertRaises(MyException, tt.join)
84
84
        self.assertEquals(True, tt.sync_event.isSet())
85
85
 
86
 
    def test_set_and_switch(self):
 
86
    def test_switch_and_set(self):
87
87
        """Caller can precisely control a thread."""
88
88
        control1 = threading.Event()
89
89
        control2 = threading.Event()
104
104
            def step_by_step(self):
105
105
                control1.wait()
106
106
                self.current_step = 'step1'
107
 
                self.set_and_switch(self.step2)
 
107
                self.switch_and_set(self.step2)
108
108
                control2.wait()
109
109
                self.current_step = 'step2'
110
 
                self.set_and_switch(self.final)
 
110
                self.switch_and_set(self.final)
111
111
                control3.wait()
112
112
                self.current_step = 'done'
113
113
 
125
125
        tt.join()
126
126
        self.assertEquals('done', tt.current_step)
127
127
 
128
 
    def test_exception_while_set_and_switch(self):
 
128
    def test_exception_while_switch_and_set(self):
129
129
        control1 = threading.Event()
130
130
 
131
131
        class MyException(Exception):
146
146
            def step_by_step(self):
147
147
                control1.wait()
148
148
                self.current_step = 'step1'
149
 
                self.set_and_switch(self.step2)
 
149
                self.switch_and_set(self.step2)
150
150
 
151
151
            def set_sync_event(self, event):
152
152
                # We force an exception while trying to set step2