Fixed integration with other modules/tests

This commit is contained in:
victor 2018-08-19 15:26:57 +02:00
parent 8b2c91836b
commit 0564b52c0e
4 changed files with 12 additions and 10 deletions

View File

@ -102,7 +102,8 @@ class PdbInvoke(object):
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:
out, err = capman.suspend_global_capture(in_=True) capman.suspend_global_capture(in_=True)
out, err = capman.snap_global_capture()
sys.stdout.write(out) sys.stdout.write(out)
sys.stdout.write(err) sys.stdout.write(err)
_enter_pdb(node, call.excinfo, report) _enter_pdb(node, call.excinfo, report)

View File

@ -51,7 +51,8 @@ def _show_fixture_action(fixturedef, msg):
config = fixturedef._fixturemanager.config config = fixturedef._fixturemanager.config
capman = config.pluginmanager.getplugin("capturemanager") capman = config.pluginmanager.getplugin("capturemanager")
if capman: if capman:
out, err = capman.suspend_global_capture() capman.suspend_global_capture()
out, err = capman.snap_global_capture()
tw = config.get_terminal_writer() tw = config.get_terminal_writer()
tw.line() tw.line()

View File

@ -890,10 +890,6 @@ def test_live_logging_suspends_capture(has_capture_manager, request):
yield yield
self.calls.append("exit disabled") self.calls.append("exit disabled")
# sanity check
assert CaptureManager.suspend_capture_item
assert CaptureManager.resume_global_capture
class DummyTerminal(six.StringIO): class DummyTerminal(six.StringIO):
def section(self, *args, **kwargs): def section(self, *args, **kwargs):
pass pass

View File

@ -70,19 +70,23 @@ class TestCaptureManager(object):
try: try:
capman = CaptureManager(method) capman = CaptureManager(method)
capman.start_global_capturing() capman.start_global_capturing()
outerr = capman.suspend_global_capture() capman.suspend_global_capture()
outerr = capman.snap_global_capture()
assert outerr == ("", "") assert outerr == ("", "")
outerr = capman.suspend_global_capture() capman.suspend_global_capture()
outerr = capman.snap_global_capture()
assert outerr == ("", "") assert outerr == ("", "")
print("hello") print("hello")
out, err = capman.suspend_global_capture() capman.suspend_global_capture()
out, err = capman.snap_global_capture()
if method == "no": if method == "no":
assert old == (sys.stdout, sys.stderr, sys.stdin) assert old == (sys.stdout, sys.stderr, sys.stdin)
else: else:
assert not out assert not out
capman.resume_global_capture() capman.resume_global_capture()
print("hello") print("hello")
out, err = capman.suspend_global_capture() capman.suspend_global_capture()
out, err = capman.snap_global_capture()
if method != "no": if method != "no":
assert out == "hello\n" assert out == "hello\n"
capman.stop_global_capturing() capman.stop_global_capturing()