Skip to content

Commit 7be769b

Browse files
committed
Make all test threads daemons to keep CI/CD from hanging.
1 parent 59dfd8e commit 7be769b

File tree

4 files changed

+44
-16
lines changed

4 files changed

+44
-16
lines changed

tests/test_general.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,12 @@ def _calls_wait_for_calc_timeout_fast(res_queue):
8686
res_queue = queue.Queue()
8787
thread1 = threading.Thread(
8888
target=_calls_wait_for_calc_timeout_fast,
89-
kwargs={'res_queue': res_queue})
89+
kwargs={'res_queue': res_queue},
90+
daemon=True)
9091
thread2 = threading.Thread(
9192
target=_calls_wait_for_calc_timeout_fast,
92-
kwargs={'res_queue': res_queue})
93+
kwargs={'res_queue': res_queue},
94+
daemon=True)
9395

9496
thread1.start()
9597
thread2.start()
@@ -124,10 +126,12 @@ def _calls_wait_for_calc_timeout_slow(res_queue):
124126
res_queue = queue.Queue()
125127
thread1 = threading.Thread(
126128
target=_calls_wait_for_calc_timeout_slow,
127-
kwargs={'res_queue': res_queue})
129+
kwargs={'res_queue': res_queue},
130+
daemon=True)
128131
thread2 = threading.Thread(
129132
target=_calls_wait_for_calc_timeout_slow,
130-
kwargs={'res_queue': res_queue})
133+
kwargs={'res_queue': res_queue},
134+
daemon=True)
131135

132136
thread1.start()
133137
thread2.start()

tests/test_memory_core.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,13 @@ def test_memory_being_calculated():
172172
_takes_time.clear_cache()
173173
res_queue = queue.Queue()
174174
thread1 = threading.Thread(
175-
target=_calls_takes_time, kwargs={'res_queue': res_queue})
175+
target=_calls_takes_time,
176+
kwargs={'res_queue': res_queue},
177+
daemon=True)
176178
thread2 = threading.Thread(
177-
target=_calls_takes_time, kwargs={'res_queue': res_queue})
179+
target=_calls_takes_time,
180+
kwargs={'res_queue': res_queue},
181+
daemon=True)
178182
thread1.start()
179183
sleep(0.5)
180184
thread2.start()
@@ -206,9 +210,13 @@ def test_being_calc_next_time():
206210
sleep(1.1)
207211
res_queue = queue.Queue()
208212
thread1 = threading.Thread(
209-
target=_calls_being_calc_next_time, kwargs={'res_queue': res_queue})
213+
target=_calls_being_calc_next_time,
214+
kwargs={'res_queue': res_queue},
215+
daemon=True)
210216
thread2 = threading.Thread(
211-
target=_calls_being_calc_next_time, kwargs={'res_queue': res_queue})
217+
target=_calls_being_calc_next_time,
218+
kwargs={'res_queue': res_queue},
219+
daemon=True)
212220
thread1.start()
213221
sleep(0.5)
214222
thread2.start()
@@ -240,9 +248,13 @@ def test_clear_being_calculated():
240248
_takes_time.clear_cache()
241249
res_queue = queue.Queue()
242250
thread1 = threading.Thread(
243-
target=_calls_takes_time, kwargs={'res_queue': res_queue})
251+
target=_calls_takes_time,
252+
kwargs={'res_queue': res_queue},
253+
daemon=True)
244254
thread2 = threading.Thread(
245-
target=_calls_takes_time, kwargs={'res_queue': res_queue})
255+
target=_calls_takes_time,
256+
kwargs={'res_queue': res_queue},
257+
daemon=True)
246258
thread1.start()
247259
_takes_time.clear_being_calculated()
248260
sleep(0.5)

tests/test_mongo_core.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,13 @@ def _takes_time(arg_1, arg_2):
144144
_takes_time.clear_cache()
145145
res_queue = queue.Queue()
146146
thread1 = threading.Thread(
147-
target=_calls_takes_time, kwargs={'res_queue': res_queue})
147+
target=_calls_takes_time,
148+
kwargs={'res_queue': res_queue},
149+
daemon=True)
148150
thread2 = threading.Thread(
149-
target=_calls_takes_time, kwargs={'res_queue': res_queue})
151+
target=_calls_takes_time,
152+
kwargs={'res_queue': res_queue},
153+
daemon=True)
150154
thread1.start()
151155
sleep(1)
152156
thread2.start()

tests/test_pickle_core.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,16 @@ def test_pickle_being_calculated(separate_files):
222222
kwargs={
223223
'takes_time_func': _takes_time_decorated,
224224
'res_queue': res_queue,
225-
}
225+
},
226+
daemon=True,
226227
)
227228
thread2 = threading.Thread(
228229
target=_calls_takes_time,
229230
kwargs={
230231
'takes_time_func': _takes_time_decorated,
231232
'res_queue': res_queue,
232-
}
233+
},
234+
daemon=True,
233235
)
234236
thread1.start()
235237
sleep(0.5)
@@ -271,14 +273,16 @@ def test_being_calc_next_time(separate_files):
271273
kwargs={
272274
'being_calc_func': _being_calc_next_time_decorated,
273275
'res_queue': res_queue,
274-
}
276+
},
277+
daemon=True,
275278
)
276279
thread2 = threading.Thread(
277280
target=_calls_being_calc_next_time,
278281
kwargs={
279282
'being_calc_func': _being_calc_next_time_decorated,
280283
'res_queue': res_queue,
281-
}
284+
},
285+
daemon=True,
282286
)
283287
thread1.start()
284288
sleep(0.5)
@@ -339,6 +343,7 @@ def _helper_bad_cache_file(sleeptime, separate_files):
339343
'trash_cache': True,
340344
'separate_files': separate_files,
341345
},
346+
daemon=True,
342347
)
343348
thread2 = threading.Thread(
344349
target=_calls_bad_cache,
@@ -348,6 +353,7 @@ def _helper_bad_cache_file(sleeptime, separate_files):
348353
'trash_cache': False,
349354
'separate_files': separate_files,
350355
},
356+
daemon=True,
351357
)
352358
thread1.start()
353359
sleep(sleeptime)
@@ -427,6 +433,7 @@ def _helper_delete_cache_file(sleeptime, separate_files):
427433
'del_cache': True,
428434
'separate_files': separate_files,
429435
},
436+
daemon=True,
430437
)
431438
thread2 = threading.Thread(
432439
target=_calls_delete_cache,
@@ -436,6 +443,7 @@ def _helper_delete_cache_file(sleeptime, separate_files):
436443
'del_cache': False,
437444
'separate_files': separate_files,
438445
},
446+
daemon=True,
439447
)
440448
thread1.start()
441449
sleep(sleeptime)

0 commit comments

Comments
 (0)