]> granicus.if.org Git - python/commitdiff
Issue #17248: Fix os.*chown() testing when user has group root.
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 20 Feb 2013 17:47:31 +0000 (19:47 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Wed, 20 Feb 2013 17:47:31 +0000 (19:47 +0200)
Lib/test/test_posix.py

index 35264f7ddcaad7c6acb0455996e4e9adb892017b..073e069ee8d1e4a9613c34d8705b68d760da1fa5 100644 (file)
@@ -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)