Skip to content

Commit 1812387

Browse files
Mark: fix python 3 compatibility
1 parent 10094a3 commit 1812387

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

_pytest/compat.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def isclass(object):
111111

112112
if _PY3:
113113
import codecs
114-
114+
imap = map
115115
STRING_TYPES = bytes, str
116116

117117
def _escape_strings(val):
@@ -145,6 +145,8 @@ def _escape_strings(val):
145145
else:
146146
STRING_TYPES = bytes, str, unicode
147147

148+
from itertools import imap
149+
148150
def _escape_strings(val):
149151
"""In py2 bytes and str are the same type, so return if it's a bytes
150152
object, return it unchanged if it is a full ascii string,
@@ -213,4 +215,4 @@ def _is_unittest_unexpected_success_a_failure():
213215
Changed in version 3.4: Returns False if there were any
214216
unexpectedSuccesses from tests marked with the expectedFailure() decorator.
215217
"""
216-
return sys.version_info >= (3, 4)
218+
return sys.version_info >= (3, 4)

_pytest/mark.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import inspect
33
from collections import namedtuple
44
from operator import attrgetter
5-
from itertools import imap
5+
from .compat import imap
66

77
def alias(name):
88
return property(attrgetter(name), doc='alias for ' + name)

0 commit comments

Comments
 (0)