summaryrefslogtreecommitdiffstats
path: root/Lib/test/_test_multiprocessing.py
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2018-10-13 09:26:09 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2018-10-13 09:26:09 (GMT)
commit0461704060474cb358d3495322950c4fd00616a0 (patch)
treecebe84cdbb8e7c0b2ec7c01e6ffd83aabbd282a3 /Lib/test/_test_multiprocessing.py
parente385d0661ecf8bc9ba95c4395d9a11262c2cbfec (diff)
downloadcpython-0461704060474cb358d3495322950c4fd00616a0.zip
cpython-0461704060474cb358d3495322950c4fd00616a0.tar.gz
cpython-0461704060474cb358d3495322950c4fd00616a0.tar.bz2
bpo-22872: multiprocessing.Queue's put() and get() now raise ValueError if the queue is closed. (GH-9010)
Previously, put() and get() would raise AssertionError and OSError, respectively.
Diffstat (limited to 'Lib/test/_test_multiprocessing.py')
-rw-r--r--Lib/test/_test_multiprocessing.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index 814aae8..dc59e9f 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -1114,6 +1114,14 @@ class _TestQueue(BaseTestCase):
# Assert that the serialization and the hook have been called correctly
self.assertTrue(not_serializable_obj.reduce_was_called)
self.assertTrue(not_serializable_obj.on_queue_feeder_error_was_called)
+
+ def test_closed_queue_put_get_exceptions(self):
+ for q in multiprocessing.Queue(), multiprocessing.JoinableQueue():
+ q.close()
+ with self.assertRaisesRegex(ValueError, 'is closed'):
+ q.put('foo')
+ with self.assertRaisesRegex(ValueError, 'is closed'):
+ q.get()
#
#
#