Rev 5657: Align method name and implementation. in file:///home/vila/src/bzr/experimental/thread-with-exception/

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Feb 10 11:57:45 UTC 2011


At file:///home/vila/src/bzr/experimental/thread-with-exception/

------------------------------------------------------------
revno: 5657
revision-id: v.ladeuil+lp at free.fr-20110210115745-iskdyofe9b64iz47
parent: v.ladeuil+lp at free.fr-20110210114948-hktri36s9tk0kdj0
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: thread-with-exception
timestamp: Thu 2011-02-10 12:57:45 +0100
message:
  Align method name and implementation.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_thread.py'
--- a/bzrlib/tests/test_thread.py	2011-02-10 11:49:48 +0000
+++ b/bzrlib/tests/test_thread.py	2011-02-10 11:57:45 +0000
@@ -83,7 +83,7 @@
         self.assertRaises(MyException, tt.join)
         self.assertEquals(True, tt.sync_event.isSet())
 
-    def test_set_and_switch(self):
+    def test_switch_and_set(self):
         """Caller can precisely control a thread."""
         control1 = threading.Event()
         control2 = threading.Event()
@@ -104,10 +104,10 @@
             def step_by_step(self):
                 control1.wait()
                 self.current_step = 'step1'
-                self.set_and_switch(self.step2)
+                self.switch_and_set(self.step2)
                 control2.wait()
                 self.current_step = 'step2'
-                self.set_and_switch(self.final)
+                self.switch_and_set(self.final)
                 control3.wait()
                 self.current_step = 'done'
 
@@ -125,7 +125,7 @@
         tt.join()
         self.assertEquals('done', tt.current_step)
 
-    def test_exception_while_set_and_switch(self):
+    def test_exception_while_switch_and_set(self):
         control1 = threading.Event()
 
         class MyException(Exception):
@@ -146,7 +146,7 @@
             def step_by_step(self):
                 control1.wait()
                 self.current_step = 'step1'
-                self.set_and_switch(self.step2)
+                self.switch_and_set(self.step2)
 
             def set_sync_event(self, event):
                 # We force an exception while trying to set step2

=== modified file 'bzrlib/thread.py'
--- a/bzrlib/thread.py	2011-02-10 11:49:48 +0000
+++ b/bzrlib/thread.py	2011-02-10 11:57:45 +0000
@@ -69,8 +69,8 @@
         """
         self.sync_event = event
 
-    def set_and_switch(self, new):
-        """Set the current ``sync_event`` and switch to a new one.
+    def switch_and_set(self, new):
+        """Switch to a new ``sync_event`` and set the current one.
 
         Using this method protects against race conditions while setting a new
         ``sync_event``.



More information about the bazaar-commits mailing list