cpython: b58b58948c27 (original) (raw)
Mercurial > cpython
changeset 87559:b58b58948c27
Issue #19742: fix a test_pathlib failure when a file owner or group isn't in the system database [#19742]
Antoine Pitrou solipsis@pitrou.net | |
---|---|
date | Mon, 25 Nov 2013 19:51:53 +0100 |
parents | f4de1c5e381d |
children | f8ac01a762c1 |
files | Lib/test/test_pathlib.py |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-)[+] [-] Lib/test/test_pathlib.py 12 |
line wrap: on
line diff
--- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -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[](#l1.7)
try:[](#l1.8)
name = pwd.getpwuid(uid).pw_name[](#l1.9)
except KeyError:[](#l1.10)
self.skipTest([](#l1.11)
"user %d doesn't have an entry in the system database" % uid)[](#l1.12) self.assertEqual(name, p.owner())[](#l1.13)
@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[](#l1.19)
try:[](#l1.20)
name = grp.getgrgid(gid).gr_name[](#l1.21)
except KeyError:[](#l1.22)
self.skipTest([](#l1.23)
"group %d doesn't have an entry in the system database" % gid)[](#l1.24) self.assertEqual(name, p.group())[](#l1.25)