summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-02-22 10:38:06 -0500
committerNed Batchelder <ned@nedbatchelder.com>2015-02-22 10:38:06 -0500
commit60f6763320d19a317495495ffddd8327b585bf6a (patch)
treea9dafe9b4cbd144813666d967068ee1e4b4024b1
parent22f3e364c92776a0f10d1fb12b3dd8e685cb3293 (diff)
downloadpython-coveragepy-60f6763320d19a317495495ffddd8327b585bf6a.tar.gz
Testing multiprocessing occasionally failed, due to randomness. Try harder.
-rw-r--r--tests/test_concurrency.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py
index 9a82a0c..93809df 100644
--- a/tests/test_concurrency.py
+++ b/tests/test_concurrency.py
@@ -239,7 +239,7 @@ class MultiprocessingTest(CoverageTest):
def func(x):
# Need to pause, or the tasks go too quick, and some processes
# in the pool don't get any work, and then don't record data.
- time.sleep(0.01)
+ time.sleep(0.02)
# Use different lines in different subprocesses.
if x % 2:
y = x*x
@@ -249,7 +249,7 @@ class MultiprocessingTest(CoverageTest):
if __name__ == "__main__":
pool = multiprocessing.Pool(3)
- inputs = range(20)
+ inputs = range(30)
outputs = pool.imap_unordered(func, inputs)
pids = set()
total = 0
@@ -264,8 +264,7 @@ class MultiprocessingTest(CoverageTest):
out = self.run_command(
"coverage run --concurrency=multiprocessing multi.py"
)
- os.system("cp .cov* /tmp")
- total = sum(x*x if x%2 else x*x*x for x in range(20))
+ total = sum(x*x if x%2 else x*x*x for x in range(30))
self.assertEqual(out.rstrip(), "3 pids, total = %d" % total)
self.run_command("coverage combine")