Fix bug in OutputCapturer

This commit is contained in:
Ram Rachum 2020-05-05 13:55:10 +03:00
parent 679a77e336
commit a602866ce1
2 changed files with 12 additions and 1 deletions

View file

@ -213,7 +213,6 @@ class OutputCapturer(object):
# Not doing exception swallowing anywhere here.
self._stderr_temp_setter.__exit__(exc_type, exc_value, exc_traceback)
self._stdout_temp_setter.__exit__(exc_type, exc_value, exc_traceback)
return self
output = property(lambda self: self.string_io.getvalue(),
doc='''The string of output that was captured.''')

View file

@ -0,0 +1,12 @@
# Copyright 2019 Ram Rachum and collaborators.
# This program is distributed under the MIT license.
import pytest
from . import mini_toolbox
def test_output_capturer_doesnt_swallow_exceptions():
with pytest.raises(ZeroDivisionError):
with mini_toolbox.OutputCapturer():
1 / 0