Merge merge branch
I suspect I don't yet know how to use git... Surely I don't need two merges to merge a contribution.
This commit is contained in:
commit
97e5f7d7e9
|
@ -1,5 +1,9 @@
|
|||
2.8.0.dev (compared to 2.7.X)
|
||||
-----------------------------
|
||||
|
||||
- Deal with capturing failures better so fewer exceptions get lost to
|
||||
/dev/null. Thanks David Szotten for the PR.
|
||||
|
||||
- fix issue730: deprecate and warn about the --genscript option.
|
||||
Thanks Ronny Pfannschmidt for the report and Christian Pommranz for the PR.
|
||||
|
||||
|
|
|
@ -86,8 +86,10 @@ class CaptureManager:
|
|||
self.deactivate_funcargs()
|
||||
cap = getattr(self, "_capturing", None)
|
||||
if cap is not None:
|
||||
outerr = cap.readouterr()
|
||||
cap.suspend_capturing(in_=in_)
|
||||
try:
|
||||
outerr = cap.readouterr()
|
||||
finally:
|
||||
cap.suspend_capturing(in_=in_)
|
||||
return outerr
|
||||
|
||||
def activate_funcargs(self, pyfuncitem):
|
||||
|
|
|
@ -566,6 +566,25 @@ def test_capture_binary_output(testdir):
|
|||
result.assert_outcomes(passed=2)
|
||||
|
||||
|
||||
def test_error_during_readouterr(testdir):
|
||||
"""Make sure we suspend capturing if errors occurr during readouterr"""
|
||||
testdir.makepyfile(pytest_xyz="""
|
||||
from _pytest.capture import FDCapture
|
||||
def bad_snap(self):
|
||||
raise Exception('boom')
|
||||
assert FDCapture.snap
|
||||
FDCapture.snap = bad_snap
|
||||
""")
|
||||
result = testdir.runpytest_subprocess(
|
||||
"-p", "pytest_xyz", "--version", syspathinsert=True
|
||||
)
|
||||
result.stderr.fnmatch_lines([
|
||||
"*in bad_snap",
|
||||
" raise Exception('boom')",
|
||||
"Exception: boom",
|
||||
])
|
||||
|
||||
|
||||
class TestTextIO:
|
||||
def test_text(self):
|
||||
f = capture.TextIO()
|
||||
|
|
Loading…
Reference in New Issue