Rev 5398: Instead of time.sleep() wait for paramiko to actually finish. in http://bazaar.launchpad.net/~jameinel/bzr/2.3-bzr-connect-ssh

John Arbash Meinel john at arbash-meinel.com
Wed Sep 1 19:09:21 BST 2010


At http://bazaar.launchpad.net/~jameinel/bzr/2.3-bzr-connect-ssh

------------------------------------------------------------
revno: 5398
revision-id: john at arbash-meinel.com-20100901180914-g0mm02jj1ho8pbg2
parent: pqm at pqm.ubuntu.com-20100830143652-e1ji3zh62t50lujb
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.3-bzr-connect-ssh
timestamp: Wed 2010-09-01 13:09:14 -0500
message:
  Instead of time.sleep() wait for paramiko to actually finish.
-------------- next part --------------
=== modified file 'bzrlib/tests/stub_sftp.py'
--- a/bzrlib/tests/stub_sftp.py	2010-07-01 15:14:35 +0000
+++ b/bzrlib/tests/stub_sftp.py	2010-09-01 18:09:14 +0000
@@ -350,16 +350,11 @@
                                          StubSFTPServer, root=tcs._root,
                                          home=tcs._server_homedir)
         server = tcs._server_interface(tcs)
+        # This blocks until the key exchange has been done
         ssh_server.start_server(None, server)
-        # FIXME: Long story short:
-        # bt.test_transport.TestSSHConnections.test_bzr_connect_to_bzr_ssh
-        # fails if we wait less than 0.2 seconds... paramiko uses a lot of
-        # timeouts internally which probably mask a synchronisation
-        # problem. Note that this is the only test that requires this hack and
-        # the test may need to be fixed instead, but it's late and the test is
-        # horrible as mentioned in its comments :) -- vila 20100623
-        import time
-        time.sleep(0.2)
+        # Continue blocking until the run() loop has completed
+        ssh_server.completion_event.clear()
+        ssh_server.completion_event.wait()
 
     def wrap_for_latency(self):
         tcs = self.server.test_case_server



More information about the bazaar-commits mailing list