summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles-Henri de Boysson <ceache@users.noreply.github.com>2021-12-02 16:35:38 +0100
committerGitHub <noreply@github.com>2021-12-02 16:35:38 +0100
commitf585d605eea0a37a08aae95a8cc259b80da2ecf0 (patch)
tree623a73d6ad6d5a7b2d476799b005e322a4f7bc30
parent1ea097d5d50466705ca1ec12945ce290c256915c (diff)
parent569c89cda811593f99294c055d00ebf27aab3068 (diff)
downloadkazoo-f585d605eea0a37a08aae95a8cc259b80da2ecf0.tar.gz
Merge pull request #657 from syseleven/sneubauer/fix-deprecation-warning
fix(recipe): fix deprecation warning from threading.Event
-rw-r--r--kazoo/recipe/lock.py4
-rw-r--r--kazoo/recipe/queue.py2
-rw-r--r--kazoo/testing/harness.py4
-rw-r--r--kazoo/tests/test_lock.py8
4 files changed, 9 insertions, 9 deletions
diff --git a/kazoo/recipe/lock.py b/kazoo/recipe/lock.py
index 7722a97..8bcc236 100644
--- a/kazoo/recipe/lock.py
+++ b/kazoo/recipe/lock.py
@@ -276,7 +276,7 @@ class Lock(object):
pass # predecessor has already been deleted
else:
self.wake_event.wait(timeout)
- if not self.wake_event.isSet():
+ if not self.wake_event.is_set():
raise LockTimeout(
"Failed to acquire lock on %s after %s seconds"
% (self.path, timeout)
@@ -638,7 +638,7 @@ class Semaphore(object):
# If blocking, wait until self._watch_lease_change() is
# called before returning
self.wake_event.wait(w.leftover())
- if not self.wake_event.isSet():
+ if not self.wake_event.is_set():
raise LockTimeout(
"Failed to acquire semaphore on %s"
" after %s seconds" % (self.path, timeout)
diff --git a/kazoo/recipe/queue.py b/kazoo/recipe/queue.py
index 5fd7f89..3887973 100644
--- a/kazoo/recipe/queue.py
+++ b/kazoo/recipe/queue.py
@@ -292,7 +292,7 @@ class LockingQueue(BaseQueue):
if event is not None and event.type != EventType.CHILD:
return
with lock:
- if canceled or flag.isSet():
+ if canceled or flag.is_set():
return
values = self.client.retry(
self.client.get_children,
diff --git a/kazoo/testing/harness.py b/kazoo/testing/harness.py
index ce8748a..4cd419d 100644
--- a/kazoo/testing/harness.py
+++ b/kazoo/testing/harness.py
@@ -229,11 +229,11 @@ class KazooTestHarness(unittest.TestCase):
self.client._call(break_event, None)
lost.wait(5)
- if not lost.isSet():
+ if not lost.is_set():
raise Exception("Failed to get notified of broken connection.")
safe.wait(15)
- if not safe.isSet():
+ if not safe.is_set():
raise Exception("Failed to see client reconnect.")
self.client.retry(self.client.get_async, '/')
diff --git a/kazoo/tests/test_lock.py b/kazoo/tests/test_lock.py
index 0e16949..edfdb90 100644
--- a/kazoo/tests/test_lock.py
+++ b/kazoo/tests/test_lock.py
@@ -397,7 +397,7 @@ class KazooLockTests(KazooTestCase):
with lock:
started.set()
event.wait(timeout)
- if not event.isSet():
+ if not event.is_set():
# Eventually fail to avoid hanging the tests
self.fail("lock2 never timed out")
@@ -409,7 +409,7 @@ class KazooLockTests(KazooTestCase):
client2 = self._get_client()
client2.start()
started.wait(5)
- assert started.isSet() is True
+ assert started.is_set() is True
lock2 = client2.Lock(self.lockpath, "two")
try:
lock2.acquire(timeout=timeout)
@@ -712,7 +712,7 @@ class TestSemaphore(KazooTestCase):
with sem:
started.set()
event.wait(timeout)
- if not event.isSet():
+ if not event.is_set():
# Eventually fail to avoid hanging the tests
self.fail("sem2 never timed out")
@@ -724,7 +724,7 @@ class TestSemaphore(KazooTestCase):
client2 = self._get_client()
client2.start()
started.wait(5)
- assert started.isSet() is True
+ assert started.is_set() is True
sem2 = client2.Semaphore(self.lockpath, "two")
try:
sem2.acquire(timeout=timeout)