summaryrefslogtreecommitdiff
path: root/Lib/test/test_multiprocessing.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-02-25 22:07:43 +0000
committerAntoine Pitrou <solipsis@pitrou.net>2011-02-25 22:07:43 +0000
commit0bd4deba383b1c7f05a4e0c94f1d4b96050a1308 (patch)
treefd95fcfc38af8fceb8e56409f63e4e2bd30e0c52 /Lib/test/test_multiprocessing.py
parent4bc685752f9f1056545ab121db833a4a68dd794c (diff)
downloadcpython-git-0bd4deba383b1c7f05a4e0c94f1d4b96050a1308.tar.gz
Issue #6064: Add a `daemon` keyword argument to the threading.Thread
and multiprocessing.Process constructors in order to override the default behaviour of inheriting the daemonic property from the current thread/process.
Diffstat (limited to 'Lib/test/test_multiprocessing.py')
-rw-r--r--Lib/test/test_multiprocessing.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
index 465a83102e..d154fce98a 100644
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -163,6 +163,18 @@ class _TestProcess(BaseTestCase):
self.assertEqual(current.ident, os.getpid())
self.assertEqual(current.exitcode, None)
+ def test_daemon_argument(self):
+ if self.TYPE == "threads":
+ return
+
+ # By default uses the current process's daemon flag.
+ proc0 = self.Process(target=self._test)
+ self.assertEquals(proc0.daemon, self.current_process().daemon)
+ proc1 = self.Process(target=self._test, daemon=True)
+ self.assertTrue(proc1.daemon)
+ proc2 = self.Process(target=self._test, daemon=False)
+ self.assertFalse(proc2.daemon)
+
@classmethod
def _test(cls, q, *args, **kwds):
current = cls.current_process()