summaryrefslogtreecommitdiff
path: root/_pytest
diff options
context:
space:
mode:
authorBruno Oliveira <nicoddemus@gmail.com>2016-09-22 17:37:52 -0300
committerGitHub <noreply@github.com>2016-09-22 17:37:52 -0300
commite5deb8a9271de94d9815abdbc3aa9b82697d1379 (patch)
tree15ddb5490749e693ef71bbdd72d59fc4dc049058 /_pytest
parentf279bd2bd5871b05e95e49e79fd9dff54e16e923 (diff)
parent24db3c123d784d476bc2b5d77e04cb7bb0956174 (diff)
downloadpytest-e5deb8a9271de94d9815abdbc3aa9b82697d1379.tar.gz
Merge pull request #1955 from rowillia/fix_python3_deprecation_warnings
Fix `DeprecationWarnings` found when running py.test in Python 2.7 with the -3 flag.
Diffstat (limited to '_pytest')
-rw-r--r--_pytest/_code/code.py3
-rw-r--r--_pytest/_code/source.py2
-rw-r--r--_pytest/assertion/util.py2
-rw-r--r--_pytest/python.py4
4 files changed, 10 insertions, 1 deletions
diff --git a/_pytest/_code/code.py b/_pytest/_code/code.py
index 9a6d32665..30e12940b 100644
--- a/_pytest/_code/code.py
+++ b/_pytest/_code/code.py
@@ -12,6 +12,7 @@ if sys.version_info[0] >= 3:
else:
from ._py2traceback import format_exception_only
+
class Code(object):
""" wrapper around Python code objects """
def __init__(self, rawcode):
@@ -28,6 +29,8 @@ class Code(object):
def __eq__(self, other):
return self.raw == other.raw
+ __hash__ = None
+
def __ne__(self, other):
return not self == other
diff --git a/_pytest/_code/source.py b/_pytest/_code/source.py
index a1521f8a2..2d55cd07f 100644
--- a/_pytest/_code/source.py
+++ b/_pytest/_code/source.py
@@ -52,6 +52,8 @@ class Source(object):
return str(self) == other
return False
+ __hash__ = None
+
def __getitem__(self, key):
if isinstance(key, int):
return self.lines[key]
diff --git a/_pytest/assertion/util.py b/_pytest/assertion/util.py
index 2481cf34c..4a0a4e431 100644
--- a/_pytest/assertion/util.py
+++ b/_pytest/assertion/util.py
@@ -105,7 +105,7 @@ except NameError:
def assertrepr_compare(config, op, left, right):
"""Return specialised explanations for some operators/operands"""
width = 80 - 15 - len(op) - 2 # 15 chars indentation, 1 space around op
- left_repr = py.io.saferepr(left, maxsize=int(width/2))
+ left_repr = py.io.saferepr(left, maxsize=int(width//2))
right_repr = py.io.saferepr(right, maxsize=width-len(left_repr))
summary = u('%s %s %s') % (ecu(left_repr), op, ecu(right_repr))
diff --git a/_pytest/python.py b/_pytest/python.py
index a361af874..eacea994d 100644
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -1357,6 +1357,8 @@ class approx(object):
return False
return all(a == x for a, x in zip(actual, self.expected))
+ __hash__ = None
+
def __ne__(self, actual):
return not (actual == self)
@@ -1436,6 +1438,8 @@ class ApproxNonIterable(object):
# Return true if the two numbers are within the tolerance.
return abs(self.expected - actual) <= self.tolerance
+ __hash__ = None
+
def __ne__(self, actual):
return not (actual == self)