Merge pull request #3529 from asottile/unpy25

Remove some python2.5 compatibility code
This commit is contained in:
Ronny Pfannschmidt 2018-06-04 16:25:00 +02:00 committed by GitHub
commit a7f9e8382b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 8 deletions

View File

@ -0,0 +1 @@
Remove some python2.5 compatibility code.

View File

@ -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)

View File

@ -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):

View File

@ -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]))

View File

@ -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)