__code__ and __self__ are attributes in python2.6+
This commit is contained in:
parent
3d0717813a
commit
04f08b67a4
|
@ -83,7 +83,7 @@ def iscoroutinefunction(func):
|
|||
|
||||
def getlocation(function, curdir):
|
||||
fn = py.path.local(inspect.getfile(function))
|
||||
lineno = py.builtin._getcode(function).co_firstlineno
|
||||
lineno = function.__code__.co_firstlineno
|
||||
if fn.relto(curdir):
|
||||
fn = fn.relto(curdir)
|
||||
return "%s:%d" % (fn, lineno + 1)
|
||||
|
|
|
@ -354,8 +354,7 @@ class FixtureRequest(FuncargnamesCompatAttr):
|
|||
return self._pyfuncitem._testcase
|
||||
except AttributeError:
|
||||
function = getattr(self, "function", None)
|
||||
if function is not None:
|
||||
return py.builtin._getimself(function)
|
||||
return getattr(function, "__self__", None)
|
||||
|
||||
@scopeproperty()
|
||||
def module(self):
|
||||
|
|
Loading…
Reference in New Issue