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

Lawrence D'Anna via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 19 21:21:17 PDT 2019


lawrence_danna created this revision.
lawrence_danna added reviewers: JDevlieghere, jasonmolenda.
Herald added a project: LLDB.

`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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67791

Files:
  lldb/third_party/Python/module/unittest2/unittest2/loader.py


Index: lldb/third_party/Python/module/unittest2/unittest2/loader.py
===================================================================
--- lldb/third_party/Python/module/unittest2/unittest2/loader.py
+++ lldb/third_party/Python/module/unittest2/unittest2/loader.py
@@ -117,7 +117,7 @@
             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__)])


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67791.220941.patch
Type: text/x-patch
Size: 754 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190920/52614d6c/attachment-0001.bin>


More information about the lldb-commits mailing list