[Python-checkins] r78754 - in python/branches/release26-maint: Lib/test/test_os.py

gregory.p.smith python-checkins at python.org
Sun Mar 7 06:58:43 CET 2010


Author: gregory.p.smith
Date: Sun Mar  7 06:58:43 2010
New Revision: 78754

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

........
  r78718 | gregory.p.smith | 2010-03-05 23:35:19 -0800 (Fri, 05 Mar 2010) | 3 lines
  
  Call setreuid and setregid in a subprocess to avoid altering the test runner's
  process state.  Should fix issue8045.
........


Modified:
   python/branches/release26-maint/   (props changed)
   python/branches/release26-maint/Lib/test/test_os.py

Modified: python/branches/release26-maint/Lib/test/test_os.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_os.py	(original)
+++ python/branches/release26-maint/Lib/test/test_os.py	Sun Mar  7 06:58:43 2010
@@ -643,7 +643,14 @@
                     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):
@@ -651,7 +658,14 @@
                     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)'])
 else:
     class PosixUidGidTests(unittest.TestCase):
         pass


More information about the Python-checkins mailing list