fix some py3 issues, particularly for 3.1.2 which has truncate(0) not change the file position
so that a seek(0) is needed in addition. --HG-- branch : trunk
This commit is contained in:
parent
78d33a2f28
commit
37cdf17e0e
|
@ -310,9 +310,11 @@ class StdCapture(Capture):
|
||||||
if self._out:
|
if self._out:
|
||||||
out = sys.stdout.getvalue()
|
out = sys.stdout.getvalue()
|
||||||
sys.stdout.truncate(0)
|
sys.stdout.truncate(0)
|
||||||
|
sys.stdout.seek(0)
|
||||||
if self._err:
|
if self._err:
|
||||||
err = sys.stderr.getvalue()
|
err = sys.stderr.getvalue()
|
||||||
sys.stderr.truncate(0)
|
sys.stderr.truncate(0)
|
||||||
|
sys.stderr.seek(0)
|
||||||
return out, err
|
return out, err
|
||||||
|
|
||||||
class DontReadFromInput:
|
class DontReadFromInput:
|
||||||
|
|
|
@ -443,7 +443,8 @@ class LineComp:
|
||||||
"""
|
"""
|
||||||
__tracebackhide__ = True
|
__tracebackhide__ = True
|
||||||
val = self.stringio.getvalue()
|
val = self.stringio.getvalue()
|
||||||
self.stringio.truncate(0) # remove what we got
|
self.stringio.truncate(0)
|
||||||
|
self.stringio.seek(0)
|
||||||
lines1 = val.split("\n")
|
lines1 = val.split("\n")
|
||||||
return LineMatcher(lines1).fnmatch_lines(lines2)
|
return LineMatcher(lines1).fnmatch_lines(lines2)
|
||||||
|
|
||||||
|
|
|
@ -287,12 +287,13 @@ class OutcomeException(Exception):
|
||||||
__str__ = __repr__
|
__str__ = __repr__
|
||||||
|
|
||||||
class Skipped(OutcomeException):
|
class Skipped(OutcomeException):
|
||||||
# XXX slighly hackish: on 3k we fake to live in the builtins
|
# XXX hackish: on 3k we fake to live in the builtins
|
||||||
# in order to have Skipped exception printing shorter/nicer
|
# in order to have Skipped exception printing shorter/nicer
|
||||||
__module__ = 'builtins'
|
__module__ = 'builtins'
|
||||||
|
|
||||||
class Failed(OutcomeException):
|
class Failed(OutcomeException):
|
||||||
""" raised from an explicit call to py.test.fail() """
|
""" raised from an explicit call to py.test.fail() """
|
||||||
|
__module__ = 'builtins'
|
||||||
|
|
||||||
class ExceptionFailure(Failed):
|
class ExceptionFailure(Failed):
|
||||||
""" raised by py.test.raises on an exception-assertion mismatch. """
|
""" raised by py.test.raises on an exception-assertion mismatch. """
|
||||||
|
|
Loading…
Reference in New Issue