]> granicus.if.org Git - python/commitdiff
bpo-30356: Fix test_mymanager_context() of multiprocessing (GH-7968)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 27 Jun 2018 16:45:01 +0000 (09:45 -0700)
committerGitHub <noreply@github.com>
Wed, 27 Jun 2018 16:45:01 +0000 (09:45 -0700)
test_mymanager_context() now also accepts -SIGTERM as an expected
exitcode for the manager process. The process is killed with SIGTERM
if it takes longer than 1 second to stop.
(cherry picked from commit fbd7172325e6ce55b6d5d3d7603e4c1c8a219cb8)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
Lib/test/_test_multiprocessing.py

index 3fa45b6787332efb15eda9b65862c33c794e8988..e0edff419231c48475c9470e260827a34f1a00b4 100644 (file)
@@ -2400,7 +2400,9 @@ class _TestMyManager(BaseTestCase):
     def test_mymanager_context(self):
         with MyManager() as manager:
             self.common(manager)
-        self.assertEqual(manager._process.exitcode, 0)
+        # bpo-30356: BaseManager._finalize_manager() sends SIGTERM
+        # to the manager process if it takes longer than 1 second to stop.
+        self.assertIn(manager._process.exitcode, (0, -signal.SIGTERM))
 
     def test_mymanager_context_prestarted(self):
         manager = MyManager()