mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
Fix test_spwd on OpenIndiana
Issue #18787: restore "bin" name in test_spwd but catch KeyError.
This commit is contained in:
parent
c53195bbf0
commit
0069aef51a
1 changed files with 8 additions and 3 deletions
|
@ -61,9 +61,14 @@ class TestSpwdRoot(unittest.TestCase):
|
||||||
class TestSpwdNonRoot(unittest.TestCase):
|
class TestSpwdNonRoot(unittest.TestCase):
|
||||||
|
|
||||||
def test_getspnam_exception(self):
|
def test_getspnam_exception(self):
|
||||||
with self.assertRaises(PermissionError) as cm:
|
name = 'bin'
|
||||||
spwd.getspnam('root')
|
try:
|
||||||
self.assertEqual(str(cm.exception), '[Errno 13] Permission denied')
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue