]> granicus.if.org Git - python/commitdiff
bpo-30356: Fix test_mymanager_context() of multiprocessing (GH-7968)
authorVictor Stinner <vstinner@redhat.com>
Wed, 27 Jun 2018 16:18:10 +0000 (18:18 +0200)
committerGitHub <noreply@github.com>
Wed, 27 Jun 2018 16:18:10 +0000 (18:18 +0200)
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.

Lib/test/_test_multiprocessing.py

index 424e1fa07a2927b48e0c8596ba767bc3fd93ed9f..5d094f9ca4a13bb4475ea5f1ac79f871bb962631 100644 (file)
@@ -2666,7 +2666,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()