mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +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):
|
def test_owner(self):
|
||||||
p = self.cls(BASE) / 'fileA'
|
p = self.cls(BASE) / 'fileA'
|
||||||
uid = p.stat().st_uid
|
uid = p.stat().st_uid
|
||||||
|
try:
|
||||||
name = pwd.getpwuid(uid).pw_name
|
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())
|
self.assertEqual(name, p.owner())
|
||||||
|
|
||||||
@unittest.skipUnless(grp, "the grp module is needed for this test")
|
@unittest.skipUnless(grp, "the grp module is needed for this test")
|
||||||
def test_group(self):
|
def test_group(self):
|
||||||
p = self.cls(BASE) / 'fileA'
|
p = self.cls(BASE) / 'fileA'
|
||||||
gid = p.stat().st_gid
|
gid = p.stat().st_gid
|
||||||
|
try:
|
||||||
name = grp.getgrgid(gid).gr_name
|
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())
|
self.assertEqual(name, p.group())
|
||||||
|
|
||||||
def test_unlink(self):
|
def test_unlink(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue