Rev 5285: Compatibility with python 2.5 and 2.4 for ThreadWithException.name. in file:///home/vila/src/bzr/experimental/leaking-tests/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Sat Jun 12 12:29:35 BST 2010
At file:///home/vila/src/bzr/experimental/leaking-tests/
------------------------------------------------------------
revno: 5285
revision-id: v.ladeuil+lp at free.fr-20100612112934-49gyqx2q818ok2i4
parent: v.ladeuil+lp at free.fr-20100611165629-2289p6leti24k9i8
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: propagate-exceptions
timestamp: Sat 2010-06-12 13:29:34 +0200
message:
Compatibility with python 2.5 and 2.4 for ThreadWithException.name.
* bzrlib/tests/test_server.py:
(ThreadWithException.name): Define as a property to ensure
compatibility with previous python versions.
(TestingTCPServerInAThread.start_server): Wait for the server to
start so be able to name it after its resolved (host, port).
-------------- next part --------------
=== modified file 'bzrlib/tests/test_server.py'
--- a/bzrlib/tests/test_server.py 2010-06-11 16:56:29 +0000
+++ b/bzrlib/tests/test_server.py 2010-06-12 11:29:34 +0000
@@ -262,6 +262,9 @@
self.exception = None
self.ignored_exceptions = None # see set_ignored_exceptions
+ # compatibility thunk for python-2.4 and python-2.5...
+ name = property(threading.Thread.getName, threading.Thread.setName)
+
def set_event(self, event):
self.ready = event
@@ -557,15 +560,15 @@
self.server = self.create_server()
self._server_thread = ThreadWithException(
event=self.server.started,
- name=self.server_address,
target=self.run_server)
self._server_thread.start()
# Wait for the server thread to start (i.e release the lock)
self.server.started.wait()
- if debug_threads():
- print 'Server thread %s started' % (self._server_thread.name,)
# Get the real address, especially the port
self.server_address = self.server.server_address
+ self._server_thread.name = self.server.server_address
+ if debug_threads():
+ print 'Server thread %s started' % (self._server_thread.name,)
# If an exception occured during the server start, it will get raised,
# otherwise, the server is blocked on its accept() call.
self._server_thread.pending_exception()
More information about the bazaar-commits
mailing list