[Lldb-commits] [lldb] r372441 - dotest.py: bugfix: test filters with -f do not work on Python3

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 20 16:41:29 PDT 2019


Author: jdevlieghere
Date: Fri Sep 20 16:41:29 2019
New Revision: 372441

URL: http://llvm.org/viewvc/llvm-project?rev=372441&view=rev
Log:
dotest.py: bugfix: test filters with -f do not work on Python3

dotest -f does not work on Python3.

The name types.UnboundMethodType was an alias for types.MethodType in
2.7, but it does not exist in python3. MethodType works in both.

Also the actual type returned from SomeClass.some_method in python3
will be types.Function, not MethodType.

Patch by: Lawrence D'Anna

Differential revision: https://reviews.llvm.org/D67791

Modified:
    lldb/trunk/third_party/Python/module/unittest2/unittest2/loader.py

Modified: lldb/trunk/third_party/Python/module/unittest2/unittest2/loader.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/third_party/Python/module/unittest2/unittest2/loader.py?rev=372441&r1=372440&r2=372441&view=diff
==============================================================================
--- lldb/trunk/third_party/Python/module/unittest2/unittest2/loader.py (original)
+++ lldb/trunk/third_party/Python/module/unittest2/unittest2/loader.py Fri Sep 20 16:41:29 2019
@@ -117,7 +117,7 @@ class TestLoader(unittest.TestLoader):
             return self.loadTestsFromModule(obj)
         elif isinstance(obj, type) and issubclass(obj, unittest.TestCase):
             return self.loadTestsFromTestCase(obj)
-        elif (isinstance(obj, types.UnboundMethodType) and
+        elif (isinstance(obj, (types.MethodType, types.FunctionType)) and
               isinstance(parent, type) and
               issubclass(parent, case.TestCase)):
             return self.suiteClass([parent(obj.__name__)])




More information about the lldb-commits mailing list