MCPcopy Index your code
hub / github.com/python/cpython / test_chown_gid

Method test_chown_gid

Lib/test/test_os/test_os.py:2242–2256  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2240
2241 @unittest.skipUnless(hasattr(os, 'getgroups'), 'need os.getgroups')
2242 def test_chown_gid(self):
2243 groups = os.getgroups()
2244 if len(groups) < 2:
2245 self.skipTest("test needs at least 2 groups")
2246
2247 gid_1, gid_2 = groups[:2]
2248 uid = os.stat(os_helper.TESTFN).st_uid
2249
2250 os.chown(os_helper.TESTFN, uid, gid_1)
2251 gid = os.stat(os_helper.TESTFN).st_gid
2252 self.assertEqual(gid, gid_1)
2253
2254 os.chown(os_helper.TESTFN, uid, gid_2)
2255 gid = os.stat(os_helper.TESTFN).st_gid
2256 self.assertEqual(gid, gid_2)
2257
2258 @requires_root_user
2259 @unittest.skipUnless(len(all_users) > 1, "test needs more than one user")

Callers

nothing calls this directly

Calls 4

skipTestMethod · 0.80
chownMethod · 0.80
statMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected