Skip to content

Commit

Permalink
Merge pull request #3529 from asottile/unpy25
Browse files Browse the repository at this point in the history
Remove some python2.5 compatibility code
  • Loading branch information
RonnyPfannschmidt authored Jun 4, 2018
2 parents d609b63 + 2f6555d commit a7f9e83
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions changelog/3629.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove some python2.5 compatibility code.
2 changes: 1 addition & 1 deletion src/_pytest/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions src/_pytest/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,7 @@ def instance(self):
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):
Expand Down
3 changes: 1 addition & 2 deletions testing/code/test_excinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
ReprExceptionInfo,
ExceptionChainRepr,
)
from six.moves import queue

from test_source import astonly

Expand All @@ -23,8 +24,6 @@
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]))
Expand Down
6 changes: 3 additions & 3 deletions testing/test_assertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,9 @@ def test_mojibake(self):
# 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)
Expand Down

0 comments on commit a7f9e83

Please sign in to comment.