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

Method queue_join_test

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

Source from the content-addressed store, hash-verified

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

Callers 1

test_queue_joinMethod · 0.95

Calls 7

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

Tested by

no test coverage detected