From: Victor Stinner <victor.stinner@gmail.com>
Date: Wed, 23 Mar 2016 20:15:55 +0000 (+0100)
Subject: Fix test_spwd on OpenIndiana
X-Git-Tag: v3.6.0a1~363
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0069aef51a176ec90fb93f4601636e8763e07c42;p=python

Fix test_spwd on OpenIndiana

Issue #18787: restore "bin" name in test_spwd but catch KeyError.
---

diff --git a/Lib/test/test_spwd.py b/Lib/test/test_spwd.py
index 3a11a2d1d6..e893f3a847 100644
--- a/Lib/test/test_spwd.py
+++ b/Lib/test/test_spwd.py
@@ -61,9 +61,14 @@ class TestSpwdRoot(unittest.TestCase):
 class TestSpwdNonRoot(unittest.TestCase):
 
     def test_getspnam_exception(self):
-        with self.assertRaises(PermissionError) as cm:
-            spwd.getspnam('root')
-        self.assertEqual(str(cm.exception), '[Errno 13] Permission denied')
+        name = 'bin'
+        try:
+            with self.assertRaises(PermissionError) as cm:
+                spwd.getspnam(name)
+        except KeyError as exc:
+            self.skipTest("spwd entry %r doesn't exist: %s" % (name, exc))
+        else:
+            self.assertEqual(str(cm.exception), '[Errno 13] Permission denied')
 
 
 if __name__ == "__main__":