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:
|
||||
out = sys.stdout.getvalue()
|
||||
sys.stdout.truncate(0)
|
||||
sys.stdout.seek(0)
|
||||
if self._err:
|
||||
err = sys.stderr.getvalue()
|
||||
sys.stderr.truncate(0)
|
||||
sys.stderr.seek(0)
|
||||
return out, err
|
||||
|
||||
class DontReadFromInput:
|
||||
|
|
|
@ -443,7 +443,8 @@ class LineComp:
|
|||
"""
|
||||
__tracebackhide__ = True
|
||||
val = self.stringio.getvalue()
|
||||
self.stringio.truncate(0) # remove what we got
|
||||
self.stringio.truncate(0)
|
||||
self.stringio.seek(0)
|
||||
lines1 = val.split("\n")
|
||||
return LineMatcher(lines1).fnmatch_lines(lines2)
|
||||
|
||||
|
|
|
@ -287,12 +287,13 @@ class OutcomeException(Exception):
|
|||
__str__ = __repr__
|
||||
|
||||
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
|
||||
__module__ = 'builtins'
|
||||
|
||||
class Failed(OutcomeException):
|
||||
""" raised from an explicit call to py.test.fail() """
|
||||
__module__ = 'builtins'
|
||||
|
||||
class ExceptionFailure(Failed):
|
||||
""" raised by py.test.raises on an exception-assertion mismatch. """
|
||||
|
|
Loading…
Reference in New Issue