Commit 85c91e89 authored by Antoine Pitrou's avatar Antoine Pitrou

Issue #19742: fix a test_pathlib failure when a file owner or group isn't in the system database

parent 7a9114b1
......@@ -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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment