diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-11-25 18:51:53 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-11-25 18:51:53 (GMT) |
commit | 2cf4b0f15958a510c3c5a443791985e71ad379c7 (patch) | |
tree | 072051c682c75a1e66e6b5562a3b157691f31c4f /Lib | |
parent | c7cf5fca7c66d85b5e6f50bbed000215e340915d (diff) | |
download | cpython-2cf4b0f15958a510c3c5a443791985e71ad379c7.zip cpython-2cf4b0f15958a510c3c5a443791985e71ad379c7.tar.gz cpython-2cf4b0f15958a510c3c5a443791985e71ad379c7.tar.bz2 |
Issue #19742: fix a test_pathlib failure when a file owner or group isn't in the system database
Diffstat (limited to 'Lib')
-rwxr-xr-x | Lib/test/test_pathlib.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 4108d5e..8f0855e 100755 --- 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 + 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): |