diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-03-23 20:15:55 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-03-23 20:15:55 (GMT) |
commit | 0069aef51a176ec90fb93f4601636e8763e07c42 (patch) | |
tree | 7c7e9f2f6a0748172efcf6780b54d9de9bb65b72 /Lib/test/test_spwd.py | |
parent | c53195bbf0b9f5b3bf4e8ddd1c6b12b59731a822 (diff) | |
download | cpython-0069aef51a176ec90fb93f4601636e8763e07c42.zip cpython-0069aef51a176ec90fb93f4601636e8763e07c42.tar.gz cpython-0069aef51a176ec90fb93f4601636e8763e07c42.tar.bz2 |
Fix test_spwd on OpenIndiana
Issue #18787: restore "bin" name in test_spwd but catch KeyError.
Diffstat (limited to 'Lib/test/test_spwd.py')
-rw-r--r-- | Lib/test/test_spwd.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/test/test_spwd.py b/Lib/test/test_spwd.py index 3a11a2d..e893f3a 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__": |