| 3122 | |
| 3123 | @warnings_helper.ignore_fork_in_thread_deprecation_warnings() |
| 3124 | def test_terminate(self): |
| 3125 | # Simulate slow tasks which take "forever" to complete |
| 3126 | sleep_time = support.LONG_TIMEOUT |
| 3127 | |
| 3128 | if self.TYPE == 'threads': |
| 3129 | # Thread pool workers can't be forced to quit, so if the first |
| 3130 | # task starts early enough, we will end up waiting for it. |
| 3131 | # Sleep for a shorter time, so the test doesn't block. |
| 3132 | sleep_time = 1 |
| 3133 | |
| 3134 | p = self.Pool(3) |
| 3135 | args = [sleep_time for i in range(10_000)] |
| 3136 | result = p.map_async(time.sleep, args, chunksize=1) |
| 3137 | time.sleep(0.2) # give some tasks a chance to start |
| 3138 | p.terminate() |
| 3139 | p.join() |
| 3140 | |
| 3141 | @warnings_helper.ignore_fork_in_thread_deprecation_warnings() |
| 3142 | def test_empty_iterable(self): |