Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(121773)

Unified Diff: Lib/test/test_posix.py

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_popen.py ('k') | Lib/test/test_pty.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_posix.py Tue Mar 01 10:26:10 2016 +0200
+++ b/Lib/test/test_posix.py Wed Mar 02 00:01:35 2016 +0000
@@ -6,18 +6,18 @@ from test import support
posix = support.import_module('posix')
import errno
import sys
import time
import os
import platform
import pwd
-import shutil
import stat
+import subprocess
import tempfile
import unittest
import warnings
_DUMMY_SYMLINK = os.path.join(tempfile.gettempdir(),
support.TESTFN + '-dummy-symlink')
class PosixTester(unittest.TestCase):
@@ -524,19 +524,20 @@ class PosixTester(unittest.TestCase):
raise unittest.SkipTest("Skipping because of non-standard chown() "
"behavior")
else:
# non-root cannot chown to root, raises OSError
self.assertRaises(OSError, chown_func, first_param, 0, 0)
check_stat(uid, gid)
self.assertRaises(OSError, chown_func, first_param, 0, -1)
check_stat(uid, gid)
- if 0 not in os.getgroups():
- self.assertRaises(OSError, chown_func, first_param, -1, 0)
- check_stat(uid, gid)
+ if hasattr(os, 'getgroups'):
+ if 0 not in os.getgroups():
+ self.assertRaises(OSError, chown_func, first_param, -1, 0)
+ check_stat(uid, gid)
# test illegal types
for t in str, float:
self.assertRaises(TypeError, chown_func, first_param, t(uid), gid)
check_stat(uid, gid)
self.assertRaises(TypeError, chown_func, first_param, uid, t(gid))
check_stat(uid, gid)
@unittest.skipUnless(hasattr(posix, 'chown'), "test needs os.chown()")
@@ -788,16 +789,17 @@ class PosixTester(unittest.TestCase):
@unittest.skipUnless(hasattr(os, 'getuid'), "test needs os.getuid()")
def test_getgrouplist(self):
user = pwd.getpwuid(os.getuid())[0]
group = pwd.getpwuid(os.getuid())[3]
self.assertIn(group, posix.getgrouplist(user, group))
@unittest.skipUnless(hasattr(os, 'getegid'), "test needs os.getegid()")
+ @unittest.skipUnless(hasattr(subprocess, 'Popen'), "test requires subprocess.Popen()")
def test_getgroups(self):
with os.popen('id -G 2>/dev/null') as idg:
groups = idg.read().strip()
ret = idg.close()
if ret is not None or not groups:
raise unittest.SkipTest("need working 'id -G'")
« no previous file with comments | « Lib/test/test_popen.py ('k') | Lib/test/test_pty.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+