1. Antoine Pitrou
  2. pathlib

Commits

Antoine Pitrou  committed af0aefb

Backport b58b58948c27

  • Participants
  • Parent commits 2028708
  • Branches pep428

Comments (0)

Files changed (1)

File test_pathlib.py

View file
  • Ignore whitespace
     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):