Skip to content

Commit fd3ba05

Browse files
committed
capture: don't assume that the tmpfile is backed by a BytesIO
Since tmpfile is a parameter to SysCapture, it shouldn't assume things unnecessarily, when there is an alternative.
1 parent 97bcf5a commit fd3ba05

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/_pytest/capture.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ def start(self):
281281
self._state = "started"
282282

283283
def snap(self):
284-
res = self.tmpfile.buffer.getvalue()
284+
self.tmpfile.seek(0)
285+
res = self.tmpfile.buffer.read()
285286
self.tmpfile.seek(0)
286287
self.tmpfile.truncate()
287288
return res

0 commit comments

Comments
 (0)