]> granicus.if.org Git - python/commitdiff
Merged revisions 78739 via svnmerge from v3.1.2rc1
authorBenjamin Peterson <benjamin@python.org>
Sat, 6 Mar 2010 20:37:32 +0000 (20:37 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sat, 6 Mar 2010 20:37:32 +0000 (20:37 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r78739 | benjamin.peterson | 2010-03-06 14:34:24 -0600 (Sat, 06 Mar 2010) | 10 lines

  Merged revisions 78718 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r78718 | gregory.p.smith | 2010-03-06 01:35:19 -0600 (Sat, 06 Mar 2010) | 3 lines

    Call setreuid and setregid in a subprocess to avoid altering the test runner's
    process state.  Should fix issue8045.
  ........
................

Lib/test/test_os.py

index 2d95f6224ddeeb3af5635dce6406477c3575db33..0c8e59764119f684b0a689d44596207fd4a942bd 100644 (file)
@@ -717,7 +717,14 @@ if sys.platform != 'win32':
                     self.assertRaises(os.error, os.setreuid, 0, 0)
                 self.assertRaises(OverflowError, os.setreuid, 1<<32, 0)
                 self.assertRaises(OverflowError, os.setreuid, 0, 1<<32)
-                os.setreuid(-1, -1)  # Does nothing, but it needs to accept -1
+
+            def test_setreuid_neg1(self):
+                # Needs to accept -1.  We run this in a subprocess to avoid
+                # altering the test runner's process state (issue8045).
+                import subprocess
+                subprocess.check_call([
+                        sys.executable, '-c',
+                        'import os,sys;os.setreuid(-1,-1);sys.exit(0)'])
 
         if hasattr(os, 'setregid'):
             def test_setregid(self):
@@ -725,7 +732,14 @@ if sys.platform != 'win32':
                     self.assertRaises(os.error, os.setregid, 0, 0)
                 self.assertRaises(OverflowError, os.setregid, 1<<32, 0)
                 self.assertRaises(OverflowError, os.setregid, 0, 1<<32)
-                os.setregid(-1, -1)  # Does nothing, but it needs to accept -1
+
+            def test_setregid_neg1(self):
+                # Needs to accept -1.  We run this in a subprocess to avoid
+                # altering the test runner's process state (issue8045).
+                import subprocess
+                subprocess.check_call([
+                        sys.executable, '-c',
+                        'import os,sys;os.setregid(-1,-1);sys.exit(0)'])
 
     @unittest.skipIf(sys.platform == 'darwin', "tests don't apply to OS X")
     class Pep383Tests(unittest.TestCase):