From: Carsten Schoenert <c.schoenert@t-online.de>
Date: Thu, 30 Dec 2021 07:55:17 +0100
Subject: Solve DeprecationWarning: getName() is deprecated

Using 'getName()' is deperecated within the treading module and replaced
by 'name'.

.pybuild/cpython3_3.10_promise/build/tests/test_thread_safety.py::test_promise_thread_safety
  /build/python-promise-2.3.0/.pybuild/cpython3_3.10_promise/build/tests/test_thread_safety.py:21: DeprecationWarning: getName() is deprecated, get the name attribute instead
    thread_name = threading.current_thread().getName()

.pybuild/cpython3_3.10_promise/build/tests/test_thread_safety.py::test_promise_thread_safety
  /build/python-promise-2.3.0/.pybuild/cpython3_3.10_promise/build/tests/test_thread_safety.py:33: DeprecationWarning: getName() is deprecated, get the name attribute instead
    assert_object['is_same_thread'] = (thread_name == threading.current_thread().getName())

.pybuild/cpython3_3.10_promise/build/tests/test_thread_safety.py::test_dataloader_thread_safety
.pybuild/cpython3_3.10_promise/build/tests/test_thread_safety.py::test_dataloader_thread_safety
  /build/python-promise-2.3.0/.pybuild/cpython3_3.10_promise/build/tests/test_thread_safety.py:64: DeprecationWarning: getName() is deprecated, get the name attribute instead
    thead_name = threading.current_thread().getName()

.pybuild/cpython3_3.10_promise/build/tests/test_thread_safety.py::test_dataloader_thread_safety
  /build/python-promise-2.3.0/.pybuild/cpython3_3.10_promise/build/tests/test_thread_safety.py:85: DeprecationWarning: getName() is deprecated, get the name attribute instead
    promise.get() == threading.current_thread().getName()

.pybuild/cpython3_3.10_promise/build/tests/test_thread_safety.py::test_dataloader_thread_safety
  /build/python-promise-2.3.0/.pybuild/cpython3_3.10_promise/build/tests/test_thread_safety.py:98: DeprecationWarning: getName() is deprecated, get the name attribute instead
    promise.get() == threading.current_thread().getName()
---
 tests/test_thread_safety.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/test_thread_safety.py b/tests/test_thread_safety.py
index ed55a84..61f515a 100644
--- a/tests/test_thread_safety.py
+++ b/tests/test_thread_safety.py
@@ -18,7 +18,7 @@ def test_promise_thread_safety():
     assert_object = {'is_same_thread': True}
 
     def task_1():
-        thread_name = threading.current_thread().getName()
+        thread_name = threading.current_thread().name
 
         def then_1(value): 
           # Enqueue tasks to run later. 
@@ -30,7 +30,7 @@ def test_promise_thread_safety():
           event_2.wait()  # Wait for thread 2 
        
         def then_2(value):
-          assert_object['is_same_thread'] = (thread_name == threading.current_thread().getName())
+          assert_object['is_same_thread'] = (thread_name == threading.current_thread().name)
 
         promise = Promise.resolve(None).then(then_1)
 
@@ -61,7 +61,7 @@ def test_dataloader_thread_safety():
     thread 1 batches its own `load` calls.
     """
     def load_many(keys):
-        thead_name = threading.current_thread().getName()
+        thead_name = threading.current_thread().name
         return Promise.resolve([thead_name for key in keys])
 
     thread_name_loader = DataLoader(load_many)
@@ -82,7 +82,7 @@ def test_dataloader_thread_safety():
             event_1.set()
             event_2.wait()  # Wait for thread 2 to call `load`
             assert_object['is_same_thread_1'] = (
-              promise.get() == threading.current_thread().getName()
+              promise.get() == threading.current_thread().name
             )
             event_3.set()  # Unblock thread 2
 
@@ -95,7 +95,7 @@ def test_dataloader_thread_safety():
             event_2.set()
             event_3.wait()  # Wait for thread 1 to run `dispatch_queue_batch`
             assert_object['is_same_thread_2'] = (
-              promise.get() == threading.current_thread().getName()
+              promise.get() == threading.current_thread().name
             )
             
         do().get()
