summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_concurrent_futures.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2014-01-26 17:57:51 (GMT)
committerGuido van Rossum <guido@python.org>2014-01-26 17:57:51 (GMT)
commite6994ff6e341d049ca974d88f14ad608f5cf7a64 (patch)
treefdf31e84a04b142f35c0d16fd1e36343a3e4119e /Lib/test/test_concurrent_futures.py
parent252fd0c24b15e38c80053a9569272654fd12868a (diff)
downloadcpython-e6994ff6e341d049ca974d88f14ad608f5cf7a64.zip
cpython-e6994ff6e341d049ca974d88f14ad608f5cf7a64.tar.gz
cpython-e6994ff6e341d049ca974d88f14ad608f5cf7a64.tar.bz2
Fix issue #20367: concurrent.futures.as_completed() for duplicate arguments.
Patch by Glenn Langford.
Diffstat (limited to 'Lib/test/test_concurrent_futures.py')
-rw-r--r--Lib/test/test_concurrent_futures.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py
index a7e945c..c74b2ca 100644
--- a/Lib/test/test_concurrent_futures.py
+++ b/Lib/test/test_concurrent_futures.py
@@ -350,6 +350,13 @@ class AsCompletedTests:
SUCCESSFUL_FUTURE]),
completed_futures)
+ def test_duplicate_futures(self):
+ # Issue 20367. Duplicate futures should not raise exceptions or give
+ # duplicate responses.
+ future1 = self.executor.submit(time.sleep, 2)
+ completed = [f for f in futures.as_completed([future1,future1])]
+ self.assertEqual(len(completed), 1)
+
class ThreadPoolAsCompletedTests(ThreadPoolMixin, AsCompletedTests, unittest.TestCase):
pass