]> granicus.if.org Git - python/commitdiff
Issue #25764: Skip fork failure test when run as root
authorMartin Panter <vadmium+py@gmail.com>
Fri, 11 Dec 2015 05:40:14 +0000 (05:40 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Fri, 11 Dec 2015 05:40:14 +0000 (05:40 +0000)
Lib/test/test_subprocess.py

index b32ef9788cefda29f5befa62c20b0e96856fd889..6628512893ff5ac9808793a73bd966b893007125 100644 (file)
@@ -1525,10 +1525,14 @@ class POSIXProcessTestCase(BaseTestCase):
         [_, hard] = limits
         setrlimit(RLIMIT_NPROC, (0, hard))
         self.addCleanup(setrlimit, RLIMIT_NPROC, limits)
-        # Forking should raise EAGAIN, translated to BlockingIOError
-        with self.assertRaises(BlockingIOError):
+        try:
             subprocess.call([sys.executable, '-c', ''],
                             preexec_fn=lambda: None)
+        except BlockingIOError:
+            # Forking should raise EAGAIN, translated to BlockingIOError
+            pass
+        else:
+            self.skipTest('RLIMIT_NPROC had no effect; probably superuser')
 
     def test_args_string(self):
         # args is a string