mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Issue #17248: Fix os.*chown() testing when user has group root.
This commit is contained in:
commit
205e82057d
1 changed files with 3 additions and 2 deletions
|
|
@ -451,10 +451,11 @@ class PosixTester(unittest.TestCase):
|
||||||
# non-root cannot chown to root, raises OSError
|
# non-root cannot chown to root, raises OSError
|
||||||
self.assertRaises(OSError, chown_func, first_param, 0, 0)
|
self.assertRaises(OSError, chown_func, first_param, 0, 0)
|
||||||
check_stat(uid, gid)
|
check_stat(uid, gid)
|
||||||
self.assertRaises(OSError, chown_func, first_param, -1, 0)
|
|
||||||
check_stat(uid, gid)
|
|
||||||
self.assertRaises(OSError, chown_func, first_param, 0, -1)
|
self.assertRaises(OSError, chown_func, first_param, 0, -1)
|
||||||
check_stat(uid, gid)
|
check_stat(uid, gid)
|
||||||
|
if gid != 0:
|
||||||
|
self.assertRaises(OSError, chown_func, first_param, -1, 0)
|
||||||
|
check_stat(uid, gid)
|
||||||
# test illegal types
|
# test illegal types
|
||||||
for t in str, float:
|
for t in str, float:
|
||||||
self.assertRaises(TypeError, chown_func, first_param, t(uid), gid)
|
self.assertRaises(TypeError, chown_func, first_param, t(uid), gid)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue