Skip to content

Commit fa94842

Browse files
committed
Fix test_spwd on OpenIndiana
Issue #18787: restore "bin" name in test_spwd but catch KeyError.
1 parent 25b93cb commit fa94842

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Lib/test/test_spwd.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,14 @@ def test_getspnam(self):
6161
class TestSpwdNonRoot(unittest.TestCase):
6262

6363
def test_getspnam_exception(self):
64-
with self.assertRaises(PermissionError) as cm:
65-
spwd.getspnam('root')
66-
self.assertEqual(str(cm.exception), '[Errno 13] Permission denied')
64+
name = 'bin'
65+
try:
66+
with self.assertRaises(PermissionError) as cm:
67+
spwd.getspnam(name)
68+
except KeyError as exc:
69+
self.skipTest("spwd entry %r doesn't exist: %s" % (name, exc))
70+
else:
71+
self.assertEqual(str(cm.exception), '[Errno 13] Permission denied')
6772

6873

6974
if __name__ == "__main__":

0 commit comments

Comments
 (0)