TestFileHandle.py: relax exception type checks

the exceptions returned differ between swig4 (TypeError) and swig<=3
(NotImplementedError). Just check for the base Exception class instead.

Theoretically we could switch on the swig version and expect the precise
type directly, but checking the exact type does not seem that important.

Thanks to Raphael for helping me figure this out.

llvm-svn: 374322
This commit is contained in:
Pavel Labath 2019-10-10 12:07:30 +00:00
parent 38ac46b4bc
commit 44506cd7f2
1 changed files with 3 additions and 3 deletions

View File

@ -667,10 +667,10 @@ class FileHandleTestCase(lldbtest.TestBase):
@add_test_categories(['pyapi'])
def test_exceptions(self):
self.assertRaises(TypeError, lldb.SBFile, None)
self.assertRaises(TypeError, lldb.SBFile, "ham sandwich")
self.assertRaises(Exception, lldb.SBFile, None)
self.assertRaises(Exception, lldb.SBFile, "ham sandwich")
if sys.version_info[0] < 3:
self.assertRaises(TypeError, lldb.SBFile, ReallyBadIO())
self.assertRaises(Exception, lldb.SBFile, ReallyBadIO())
else:
self.assertRaises(OhNoe, lldb.SBFile, ReallyBadIO())
error, n = lldb.SBFile(BadIO()).Write(b"FOO")