We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 25b93cb commit fa94842Copy full SHA for fa94842
Lib/test/test_spwd.py
@@ -61,9 +61,14 @@ def test_getspnam(self):
61
class TestSpwdNonRoot(unittest.TestCase):
62
63
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')
+ name = 'bin'
+ try:
+ 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')
72
73
74
if __name__ == "__main__":
0 commit comments