diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2010-03-06 07:35:19 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2010-03-06 07:35:19 (GMT) |
commit | 467298cb4251a6c09146527f1ba3c5821ada268d (patch) | |
tree | 35ae19a66c7c11e957f56b3e648a89f855741d25 | |
parent | a7fa0324fb174eb543e6fc75e615bbe228b9ccb7 (diff) | |
download | cpython-467298cb4251a6c09146527f1ba3c5821ada268d.zip cpython-467298cb4251a6c09146527f1ba3c5821ada268d.tar.gz cpython-467298cb4251a6c09146527f1ba3c5821ada268d.tar.bz2 |
Call setreuid and setregid in a subprocess to avoid altering the test runner's
process state. Should fix issue8045.
-rw-r--r-- | Lib/test/test_os.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 44cc4cb..3dd7f90 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -642,7 +642,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): @@ -650,7 +657,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)']) else: class PosixUidGidTests(unittest.TestCase): pass |