summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-03-06 20:34:24 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-03-06 20:34:24 (GMT)
commitebe87ba3e81b7f77c3479fb07ed896e2fba9a8d2 (patch)
treed89d36b00c742958804c696ceab8c93d518b0bc3
parent0e62a1488b4ba9617d659a37443238f3c1f2b506 (diff)
downloadcpython-ebe87ba3e81b7f77c3479fb07ed896e2fba9a8d2.zip
cpython-ebe87ba3e81b7f77c3479fb07ed896e2fba9a8d2.tar.gz
cpython-ebe87ba3e81b7f77c3479fb07ed896e2fba9a8d2.tar.bz2
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. ........
-rw-r--r--Lib/test/test_os.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 95c7747..6155f0a 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -738,7 +738,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):
@@ -746,7 +753,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):