From b3d62cefc781c396754f93c98e837fb073755333 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Wed, 20 Feb 2013 19:48:22 +0200 Subject: [PATCH] Issue #17248: Fix os.*chown() testing when user has group root. --- Lib/test/test_posix.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index e06ffa5be4d..5a26d649d38 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -279,10 +279,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)