mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #19742: fix a test_pathlib failure when a file owner or group isn't in the system database
This commit is contained in:
parent
c7cf5fca7c
commit
2cf4b0f159
1 changed files with 10 additions and 2 deletions
|
@ -1322,14 +1322,22 @@ class _BasePathTest(object):
|
|||
def test_owner(self):
|
||||
p = self.cls(BASE) / 'fileA'
|
||||
uid = p.stat().st_uid
|
||||
name = pwd.getpwuid(uid).pw_name
|
||||
try:
|
||||
name = pwd.getpwuid(uid).pw_name
|
||||
except KeyError:
|
||||
self.skipTest(
|
||||
"user %d doesn't have an entry in the system database" % uid)
|
||||
self.assertEqual(name, p.owner())
|
||||
|
||||
@unittest.skipUnless(grp, "the grp module is needed for this test")
|
||||
def test_group(self):
|
||||
p = self.cls(BASE) / 'fileA'
|
||||
gid = p.stat().st_gid
|
||||
name = grp.getgrgid(gid).gr_name
|
||||
try:
|
||||
name = grp.getgrgid(gid).gr_name
|
||||
except KeyError:
|
||||
self.skipTest(
|
||||
"group %d doesn't have an entry in the system database" % gid)
|
||||
self.assertEqual(name, p.group())
|
||||
|
||||
def test_unlink(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue