Merge branch 'stdout-pdb-capture'
This commit is contained in:
commit
808cb8e3ad
1
AUTHORS
1
AUTHORS
|
@ -73,3 +73,4 @@ Simon Gomizelj
|
||||||
Russel Winder
|
Russel Winder
|
||||||
Ben Webb
|
Ben Webb
|
||||||
Alexei Kozlenok
|
Alexei Kozlenok
|
||||||
|
Cal Leeming
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
- fix #1292: monkeypatch calls (setattr, setenv, etc.) are now O(1).
|
- fix #1292: monkeypatch calls (setattr, setenv, etc.) are now O(1).
|
||||||
Thanks David R. MacIver for the report and Bruno Oliveira for the PR.
|
Thanks David R. MacIver for the report and Bruno Oliveira for the PR.
|
||||||
|
|
||||||
|
- fix #1223: captured stdout and stderr are now properly displayed before
|
||||||
|
entering pdb when ``--pdb`` is used instead of being thrown away.
|
||||||
|
Thanks Cal Leeming for the PR.
|
||||||
|
|
||||||
- fix #1305: pytest warnings emitted during ``pytest_terminal_summary`` are now
|
- fix #1305: pytest warnings emitted during ``pytest_terminal_summary`` are now
|
||||||
properly displayed.
|
properly displayed.
|
||||||
Thanks Ionel Maries Cristian for the report and Bruno Oliveira for the PR.
|
Thanks Ionel Maries Cristian for the report and Bruno Oliveira for the PR.
|
||||||
|
|
|
@ -53,7 +53,9 @@ class PdbInvoke:
|
||||||
def pytest_exception_interact(self, node, call, report):
|
def pytest_exception_interact(self, node, call, report):
|
||||||
capman = node.config.pluginmanager.getplugin("capturemanager")
|
capman = node.config.pluginmanager.getplugin("capturemanager")
|
||||||
if capman:
|
if capman:
|
||||||
capman.suspendcapture(in_=True)
|
out, err = capman.suspendcapture(in_=True)
|
||||||
|
sys.stdout.write(out)
|
||||||
|
sys.stdout.write(err)
|
||||||
_enter_pdb(node, call.excinfo, report)
|
_enter_pdb(node, call.excinfo, report)
|
||||||
|
|
||||||
def pytest_internalerror(self, excrepr, excinfo):
|
def pytest_internalerror(self, excrepr, excinfo):
|
||||||
|
|
|
@ -75,6 +75,22 @@ class TestPDB:
|
||||||
if child.isalive():
|
if child.isalive():
|
||||||
child.wait()
|
child.wait()
|
||||||
|
|
||||||
|
def test_pdb_interaction_capture(self, testdir):
|
||||||
|
p1 = testdir.makepyfile("""
|
||||||
|
def test_1():
|
||||||
|
print("getrekt")
|
||||||
|
assert False
|
||||||
|
""")
|
||||||
|
child = testdir.spawn_pytest("--pdb %s" % p1)
|
||||||
|
child.expect("getrekt")
|
||||||
|
child.expect("(Pdb)")
|
||||||
|
child.sendeof()
|
||||||
|
rest = child.read().decode("utf8")
|
||||||
|
assert "1 failed" in rest
|
||||||
|
assert "getrekt" not in rest
|
||||||
|
if child.isalive():
|
||||||
|
child.wait()
|
||||||
|
|
||||||
def test_pdb_interaction_exception(self, testdir):
|
def test_pdb_interaction_exception(self, testdir):
|
||||||
p1 = testdir.makepyfile("""
|
p1 = testdir.makepyfile("""
|
||||||
import pytest
|
import pytest
|
||||||
|
|
Loading…
Reference in New Issue