[Lldb-commits] [PATCH] D13912: Make uses of metaclasses portable across Python versions
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 20 13:31:22 PDT 2015
zturner created this revision.
zturner added a reviewer: tfiala.
zturner added a subscriber: lldb-commits.
This uses the `six.add_metaclass()` decorator for portable metaclass specification.
http://reviews.llvm.org/D13912
Files:
test/dotest.py
test/lldbtest.py
Index: test/lldbtest.py
===================================================================
--- test/lldbtest.py
+++ test/lldbtest.py
@@ -33,6 +33,8 @@
from __future__ import print_function
+import lldb_shared
+
import abc
import gc
import glob
@@ -48,7 +50,8 @@
import lldb
import lldbtest_config
import lldbutil
-from _pyio import __metaclass__
+
+from six import add_metaclass
if sys.version_info.major < 3:
import urlparse
@@ -254,8 +257,8 @@
print(self.getvalue(), file=self.session)
self.close()
+ at add_metaclass(abc.ABCMeta)
class _BaseProcess(object):
- __metaclass__ = abc.ABCMeta
@abc.abstractproperty
def pid(self):
@@ -2279,6 +2282,8 @@
newattrs[attrname] = attrvalue
return super(LLDBTestCaseFactory, cls).__new__(cls, name, bases, newattrs)
+# Setup the metaclass for this class to change the list of the test methods when a new class is loaded
+ at add_metaclass(LLDBTestCaseFactory)
class TestBase(Base):
"""
This abstract base class is meant to be subclassed. It provides default
@@ -2339,9 +2344,6 @@
# Can be overridden by the LLDB_TIME_WAIT_NEXT_LAUNCH environment variable.
timeWaitNextLaunch = 1.0;
- # Setup the metaclass for this class to change the list of the test methods when a new class is loaded
- __metaclass__ = LLDBTestCaseFactory
-
def doDelay(self):
"""See option -w of dotest.py."""
if ("LLDB_WAIT_BETWEEN_TEST_CASES" in os.environ and
Index: test/dotest.py
===================================================================
--- test/dotest.py
+++ test/dotest.py
@@ -44,7 +44,6 @@
import six
-
def is_exe(fpath):
"""Returns true if fpath is an executable."""
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13912.37913.patch
Type: text/x-patch
Size: 1807 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151020/51fbca07/attachment.bin>
More information about the lldb-commits
mailing list