Skip to content

Commit

Permalink
replace deprecated occurences of Thread.isAlive() by Thread.is_alive()
Browse files Browse the repository at this point in the history
  • Loading branch information
sblondon committed Dec 13, 2019
1 parent e351754 commit c527340
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/ZEO/StorageServer.py
Expand Up @@ -939,7 +939,7 @@ def server_status(self, storage_id):
status['connections'] = len(status['connections'])
lock_manager = self.lock_managers[storage_id]
status['waiting'] = len(lock_manager.waiting)
status['timeout-thread-is-alive'] = lock_manager.timeout.isAlive()
status['timeout-thread-is-alive'] = lock_manager.timeout.is_alive()
last_transaction = self.storages[storage_id].lastTransaction()
last_transaction_hex = codecs.encode(last_transaction, 'hex_codec')
if PY3:
Expand All @@ -960,7 +960,7 @@ def begin(self, client):
def end(self, client):
pass

isAlive = lambda self: 'stub'
is_alive = lambda self: 'stub'


class TimeoutThread(threading.Thread):
Expand Down
2 changes: 1 addition & 1 deletion src/ZEO/tests/ConnectionTests.py
Expand Up @@ -493,7 +493,7 @@ def NOcheckMultiStorageTransaction(self):
# Wait for all threads to finish
for t in threads:
t.join(60)
self.assertFalse(t.isAlive(), "%s didn't die" % t.getName())
self.assertFalse(t.is_alive(), "%s didn't die" % t.getName())
finally:
for t in threads:
t.closeclients()
Expand Down
2 changes: 1 addition & 1 deletion src/ZEO/tests/TestThread.py
Expand Up @@ -53,5 +53,5 @@ def cleanup(self, timeout=15):
self.join(timeout)
if self._exc_info:
six.reraise(self._exc_info[0], self._exc_info[1], self._exc_info[2])
if self.isAlive():
if self.is_alive():
self._testcase.fail("Thread did not finish: %s" % self)
4 changes: 2 additions & 2 deletions src/ZEO/tests/ThreadTests.py
Expand Up @@ -34,7 +34,7 @@ def __init__(self, storage, doNextEvent, threadStartedEvent):

def join(self):
threading.Thread.join(self, 10)
assert not self.isAlive()
assert not self.is_alive()


class GetsThroughVoteThread(BasicThread):
Expand Down Expand Up @@ -119,7 +119,7 @@ def checkMTStores(self):
for t in threads:
t.join(30)
for i in threads:
self.assertFalse(t.isAlive())
self.assertFalse(t.is_alive())

# Helper for checkMTStores
def mtstorehelper(self):
Expand Down
4 changes: 2 additions & 2 deletions src/ZEO/tests/ZEO4/StorageServer.py
Expand Up @@ -1307,7 +1307,7 @@ def server_status(self, storage_id):
status = self.stats[storage_id].__dict__.copy()
status['connections'] = len(status['connections'])
status['waiting'] = len(self._waiting[storage_id])
status['timeout-thread-is-alive'] = self.timeouts[storage_id].isAlive()
status['timeout-thread-is-alive'] = self.timeouts[storage_id].is_alive()
last_transaction = self.storages[storage_id].lastTransaction()
last_transaction_hex = codecs.encode(last_transaction, 'hex_codec')
if PY3:
Expand Down Expand Up @@ -1336,7 +1336,7 @@ def begin(self, client):
def end(self, client):
pass

isAlive = lambda self: 'stub'
is_alive = lambda self: 'stub'


class TimeoutThread(threading.Thread):
Expand Down
4 changes: 2 additions & 2 deletions src/ZEO/tests/ZEO4/zrpc/client.py
Expand Up @@ -218,7 +218,7 @@ def close(self):
log("CM.close(): stopping and joining thread")
t.stop()
t.join(30)
if t.isAlive():
if t.is_alive():
log("CM.close(): self.thread.join() timed out",
level=logging.WARNING)

Expand Down Expand Up @@ -288,7 +288,7 @@ def connect(self, sync=0):
t.setDaemon(1)
t.start()
if sync:
while self.connection is None and t.isAlive():
while self.connection is None and t.is_alive():
self.cond.wait(self.sync_wait)
if self.connection is None:
log("CM.connect(sync=1): still waiting...")
Expand Down
2 changes: 1 addition & 1 deletion src/ZEO/tests/testConnection.py
Expand Up @@ -213,7 +213,7 @@ def invalidations_while_connecting():
... stop = True
... thread.join(10)
>>> thread.isAlive()
>>> thread.is_alive()
False
>>> for record in handler.records:
Expand Down
2 changes: 1 addition & 1 deletion src/ZEO/tests/zeo_blob_cache.test
Expand Up @@ -136,7 +136,7 @@ provoke problems:
... thread.start()
>>> for thread in threads:
... thread.join(99)
... if thread.isAlive():
... if thread.is_alive():
... print("Can't join thread.")

>>> wait_until("size is reduced", check, 99, onfail)
Expand Down

0 comments on commit c527340

Please sign in to comment.