MCPcopy Index your code
hub / github.com/python/cpython / queue_join_test

Method queue_join_test

Lib/test/test_queue.py:166–182  ·  view source on GitHub ↗
(self, q)

Source from the content-addressed store, hash-verified

164 q.task_done()
165
166 def queue_join_test(self, q):
167 self.cum = 0
168 threads = []
169 for i in (0,1):
170 thread = threading.Thread(target=self.worker, args=(q,))
171 thread.start()
172 threads.append(thread)
173 for i in range(100):
174 q.put(i)
175 q.join()
176 self.assertEqual(self.cum, sum(range(100)),
177 "q.join() did not block until all tasks were done")
178 for i in (0,1):
179 q.put(-1) # instruct the threads to close
180 q.join() # verify that you can join twice
181 for thread in threads:
182 thread.join()
183
184 def test_queue_task_done(self):
185 # Test to make sure a queue task completed successfully.

Callers 1

test_queue_joinMethod · 0.95

Calls 6

startMethod · 0.95
joinMethod · 0.95
appendMethod · 0.45
putMethod · 0.45
joinMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected