use correct attribute to find the instance of a bound method
--HG-- branch : trunk
This commit is contained in:
parent
a051eb1a05
commit
ee86950af4
|
@ -2,13 +2,18 @@ import py
|
||||||
|
|
||||||
from py.test.collect import Function
|
from py.test.collect import Function
|
||||||
|
|
||||||
|
if py.std.sys.version_info > (3, 0):
|
||||||
|
_self = "__self__"
|
||||||
|
else:
|
||||||
|
_self = "im_self"
|
||||||
|
|
||||||
class TestCaseUnit(Function):
|
class TestCaseUnit(Function):
|
||||||
""" compatibility Unit executor for TestCase methods
|
""" compatibility Unit executor for TestCase methods
|
||||||
honouring setUp and tearDown semantics.
|
honouring setUp and tearDown semantics.
|
||||||
"""
|
"""
|
||||||
def runtest(self, _deprecated=None):
|
def runtest(self, _deprecated=None):
|
||||||
boundmethod = self.obj
|
boundmethod = self.obj
|
||||||
instance = boundmethod.im_self
|
instance = getattr(boundmethod, _self)
|
||||||
instance.setUp()
|
instance.setUp()
|
||||||
try:
|
try:
|
||||||
boundmethod()
|
boundmethod()
|
||||||
|
|
Loading…
Reference in New Issue