Skip to content

Commit 9cbc589

Browse files
mariocj89cjw296
authored andcommitted
gh-106458: Mark testthreadingmock.py with @requires_working_threading (GH-106366)
Mark `testthreadingmock.py` with `threading_helper.requires_working_threading`. Also add longer delays to reduce the change of a race conditions on the tests that validate short timeouts. Backports: 56353b10023ff12c7c8d6288ae4bf7bdcd5d4b6c Signed-off-by: Chris Withers <[email protected]>
1 parent 0dc15d4 commit 9cbc589

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

lastsync.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3f7c0810f6158a7ff37be432f8d7f9511427489f
1+
2dfc7fae787e65726f24bfe9efe05418b05ee8e2

mock/tests/testthreadingmock.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,9 @@ def test_wait_failed_with_timeout_override(self):
133133

134134
with patch(f"{__name__}.Something", waitable_mock):
135135
something = Something()
136-
self.run_async(something.method_1, delay=0.1)
136+
self.run_async(something.method_1, delay=0.5)
137137
with self.assertRaises(AssertionError):
138138
something.method_1.wait_until_called(timeout=0.05)
139-
with self.assertRaises(AssertionError):
140-
something.method_1.wait_until_any_call_with(timeout=0.05)
141139

142140
def test_wait_success_called_before(self):
143141
waitable_mock = self._make_mock()
@@ -163,10 +161,10 @@ def test_wait_until_any_call_with_positional(self):
163161

164162
with patch(f"{__name__}.Something", waitable_mock):
165163
something = Something()
166-
self.run_async(something.method_1, 1, delay=0.1)
167-
self.run_async(something.method_1, 2, delay=0.2)
168-
self.run_async(something.method_1, 3, delay=0.3)
164+
self.run_async(something.method_1, 1, delay=0.2)
169165
self.assertNotIn(call(1), something.method_1.mock_calls)
166+
self.run_async(something.method_1, 2, delay=0.5)
167+
self.run_async(something.method_1, 3, delay=0.6)
170168

171169
something.method_1.wait_until_any_call_with(1)
172170
something.method_1.assert_called_with(1)
@@ -182,10 +180,10 @@ def test_wait_until_any_call_with_keywords(self):
182180

183181
with patch(f"{__name__}.Something", waitable_mock):
184182
something = Something()
185-
self.run_async(something.method_1, a=1, delay=0.1)
186-
self.run_async(something.method_1, b=2, delay=0.2)
187-
self.run_async(something.method_1, c=3, delay=0.3)
183+
self.run_async(something.method_1, a=1, delay=0.2)
188184
self.assertNotIn(call(a=1), something.method_1.mock_calls)
185+
self.run_async(something.method_1, b=2, delay=0.5)
186+
self.run_async(something.method_1, c=3, delay=0.6)
189187

190188
something.method_1.wait_until_any_call_with(a=1)
191189
something.method_1.assert_called_with(a=1)

0 commit comments

Comments
 (0)