From: Antoine Pitrou Date: Mon, 25 Nov 2013 18:51:53 +0000 (+0100) Subject: Issue #19742: fix a test_pathlib failure when a file owner or group isn't in the... X-Git-Tag: v3.4.0b2~487 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2cf4b0f15958a510c3c5a443791985e71ad379c7;p=thirdparty%2FPython%2Fcpython.git Issue #19742: fix a test_pathlib failure when a file owner or group isn't in the system database --- diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 4108d5e2fd9f..8f0855e61873 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):