MCPcopy Index your code
hub / github.com/RustPython/RustPython / _shutdown_put_join

Method _shutdown_put_join

Lib/test/test_queue.py:574–605  ·  view source on GitHub ↗
(self, immediate)

Source from the content-addressed store, hash-verified

572 return self._shutdown_join(False)
573
574 def _shutdown_put_join(self, immediate):
575 q = self.type2test(2)
576 results = []
577 go = threading.Event()
578 q.put("Y")
579 # queue not fulled
580
581 thrds = (
582 (self._put_shutdown, (q, "E", go, results)),
583 (self._join, (q, results)),
584 )
585 threads = []
586 for func, params in thrds:
587 threads.append(threading.Thread(target=func, args=params))
588 threads[-1].start()
589 self.assertEqual(q.unfinished_tasks, 1)
590
591 q.shutdown(immediate)
592 go.set()
593
594 if immediate:
595 with self.assertRaises(self.queue.ShutDown):
596 q.get_nowait()
597 else:
598 result = q.get()
599 self.assertEqual(result, "Y")
600 q.task_done()
601
602 for t in threads:
603 t.join()
604
605 self.assertEqual(results, [True]*len(thrds))
606
607 def test_shutdown_immediate_put_join(self):
608 return self._shutdown_put_join(True)

Callers 2

Calls 14

setMethod · 0.95
lenFunction · 0.85
type2testMethod · 0.80
EventMethod · 0.80
putMethod · 0.45
appendMethod · 0.45
startMethod · 0.45
assertEqualMethod · 0.45
shutdownMethod · 0.45
assertRaisesMethod · 0.45
get_nowaitMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected