[Lldb-commits] [lldb] r374322 - TestFileHandle.py: relax exception type checks

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 10 05:07:30 PDT 2019


Author: labath
Date: Thu Oct 10 05:07:30 2019
New Revision: 374322

URL: http://llvm.org/viewvc/llvm-project?rev=374322&view=rev
Log:
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.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py?rev=374322&r1=374321&r2=374322&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py Thu Oct 10 05:07:30 2019
@@ -667,10 +667,10 @@ class FileHandleTestCase(lldbtest.TestBa
 
     @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")




More information about the lldb-commits mailing list