__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):
|
def getlocation(function, curdir):
|
||||||
fn = py.path.local(inspect.getfile(function))
|
fn = py.path.local(inspect.getfile(function))
|
||||||
lineno = py.builtin._getcode(function).co_firstlineno
|
lineno = function.__code__.co_firstlineno
|
||||||
if fn.relto(curdir):
|
if fn.relto(curdir):
|
||||||
fn = fn.relto(curdir)
|
fn = fn.relto(curdir)
|
||||||
return "%s:%d" % (fn, lineno + 1)
|
return "%s:%d" % (fn, lineno + 1)
|
||||||
|
|
|
@ -354,8 +354,7 @@ class FixtureRequest(FuncargnamesCompatAttr):
|
||||||
return self._pyfuncitem._testcase
|
return self._pyfuncitem._testcase
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
function = getattr(self, "function", None)
|
function = getattr(self, "function", None)
|
||||||
if function is not None:
|
return getattr(function, "__self__", None)
|
||||||
return py.builtin._getimself(function)
|
|
||||||
|
|
||||||
@scopeproperty()
|
@scopeproperty()
|
||||||
def module(self):
|
def module(self):
|
||||||
|
|
Loading…
Reference in New Issue