From: Serhiy Storchaka Date: Wed, 20 Feb 2013 17:47:31 +0000 (+0200) Subject: Issue #17248: Fix os.*chown() testing when user has group root. X-Git-Tag: v2.7.4rc1~98 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fffc479f15636d4f6afb297f4f8fb0016cd162a6;p=python Issue #17248: Fix os.*chown() testing when user has group root. --- diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 35264f7ddc..073e069ee8 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -269,10 +269,11 @@ class PosixTester(unittest.TestCase): # 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, -1, 0) - check_stat(uid, gid) self.assertRaises(OSError, chown_func, first_param, 0, -1) check_stat(uid, gid) + if gid != 0: + 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)