File: Solve-DeprecationWarning-getName-is-deprecated.patch

package info (click to toggle)
python-promise 2.3.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 364 kB
  • sloc: python: 2,682; sh: 13; makefile: 4
file content (80 lines) | stat: -rw-r--r-- 4,109 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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()