Fix test_spwd on OpenIndiana

Issue #18787: restore "bin" name in test_spwd but catch KeyError.
This commit is contained in:
Victor Stinner 2016-03-23 21:15:55 +01:00
parent c53195bbf0
commit 0069aef51a
1 changed files with 8 additions and 3 deletions

View File

@ -61,8 +61,13 @@ class TestSpwdRoot(unittest.TestCase):
class TestSpwdNonRoot(unittest.TestCase):
def test_getspnam_exception(self):
name = 'bin'
try:
with self.assertRaises(PermissionError) as cm:
spwd.getspnam('root')
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')