Merge pull request #3529 from asottile/unpy25
Remove some python2.5 compatibility code
This commit is contained in:
commit
a7f9e8382b
|
@ -0,0 +1 @@
|
|||
Remove some python2.5 compatibility code.
|
|
@ -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):
|
||||
|
|
|
@ -13,6 +13,7 @@ from _pytest._code.code import (
|
|||
ReprExceptionInfo,
|
||||
ExceptionChainRepr,
|
||||
)
|
||||
from six.moves import queue
|
||||
|
||||
from test_source import astonly
|
||||
|
||||
|
@ -23,8 +24,6 @@ except ImportError:
|
|||
else:
|
||||
invalidate_import_caches = getattr(importlib, "invalidate_caches", None)
|
||||
|
||||
queue = py.builtin._tryimport("queue", "Queue")
|
||||
|
||||
failsonjython = pytest.mark.xfail("sys.platform.startswith('java')")
|
||||
|
||||
pytest_version_info = tuple(map(int, pytest.__version__.split(".")[:3]))
|
||||
|
|
|
@ -546,9 +546,9 @@ class TestAssert_reprcompare(object):
|
|||
# issue 429
|
||||
left = "e"
|
||||
right = "\xc3\xa9"
|
||||
if not isinstance(left, py.builtin.bytes):
|
||||
left = py.builtin.bytes(left, "utf-8")
|
||||
right = py.builtin.bytes(right, "utf-8")
|
||||
if not isinstance(left, bytes):
|
||||
left = bytes(left, "utf-8")
|
||||
right = bytes(right, "utf-8")
|
||||
expl = callequal(left, right)
|
||||
for line in expl:
|
||||
assert isinstance(line, py.builtin.text)
|
||||
|
|
Loading…
Reference in New Issue