[Python-checkins] cpython: Issue #19742: fix a test_pathlib failure when a file owner or group isn't in

antoine.pitrou python-checkins at python.org
Mon Nov 25 19:52:00 CET 2013


http://hg.python.org/cpython/rev/b58b58948c27
changeset:   87559:b58b58948c27
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Mon Nov 25 19:51:53 2013 +0100
summary:
  Issue #19742: fix a test_pathlib failure when a file owner or group isn't in the system database

files:
  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
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -1322,14 +1322,22 @@
     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):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list