bpo-33913: Fix test_multiprocessing_main_handling (GH-7972) · python/cpython@64737e9

Original file line numberDiff line numberDiff line change

@@ -57,11 +57,13 @@ def f(x):

5757

p = Pool(5)

5858

results = []

5959

p.map_async(f, [1, 2, 3], callback=results.extend)

60-

deadline = time.time() + 60 # up to 60 s to report the results

60+

start_time = time.monotonic()

6161

while not results:

6262

time.sleep(0.05)

63-

if time.time() > deadline:

64-

raise RuntimeError("Timed out waiting for results")

63+

# up to 1 min to report the results

64+

dt = time.monotonic() - start_time

65+

if dt > 60.0:

66+

raise RuntimeError("Timed out waiting for results (%.1f sec)" % dt)

6567

results.sort()

6668

print(start_method, "->", results)

6769

"""

@@ -85,11 +87,13 @@ def f(x):

8587

p = Pool(5)

8688

results = []

8789

p.map_async(int, [1, 4, 9], callback=results.extend)

88-

deadline = time.time() + 10 # up to 10 s to report the results

90+

start_time = time.monotonic()

8991

while not results:

9092

time.sleep(0.05)

91-

if time.time() > deadline:

92-

raise RuntimeError("Timed out waiting for results")

93+

# up to 1 min to report the results

94+

dt = time.monotonic() - start_time

95+

if dt > 60.0:

96+

raise RuntimeError("Timed out waiting for results (%.1f sec)" % dt)

9397

results.sort()

9498

print(start_method, "->", results)

9599

"""