Renamed snap_global_capture to read_global_capture.

This commit is contained in:
Victor 2018-08-20 17:48:14 +02:00
parent d611b03589
commit 70ebab3537
4 changed files with 10 additions and 10 deletions

View File

@ -64,7 +64,7 @@ def pytest_load_initial_conftests(early_config, parser, args):
outcome = yield
capman.suspend_global_capture()
if outcome.excinfo is not None:
out, err = capman.snap_global_capture()
out, err = capman.read_global_capture()
sys.stdout.write(out)
sys.stderr.write(err)
@ -118,7 +118,7 @@ class CaptureManager(object):
if cap is not None:
cap.suspend_capturing(in_=in_)
def snap_global_capture(self):
def read_global_capture(self):
return self._global_capturing.readouterr()
# Fixture Control (its just forwarding, think about removing this later)
@ -171,7 +171,7 @@ class CaptureManager(object):
self.deactivate_fixture(item)
self.suspend_global_capture(in_=False)
out, err = self.snap_global_capture()
out, err = self.read_global_capture()
item.add_report_section(when, "stdout", out)
item.add_report_section(when, "stderr", err)
@ -183,7 +183,7 @@ class CaptureManager(object):
self.resume_global_capture()
outcome = yield
self.suspend_global_capture()
out, err = self.snap_global_capture()
out, err = self.read_global_capture()
rep = outcome.get_result()
if out:
rep.sections.append(("Captured stdout", out))

View File

@ -103,7 +103,7 @@ class PdbInvoke(object):
capman = node.config.pluginmanager.getplugin("capturemanager")
if capman:
capman.suspend_global_capture(in_=True)
out, err = capman.snap_global_capture()
out, err = capman.read_global_capture()
sys.stdout.write(out)
sys.stdout.write(err)
_enter_pdb(node, call.excinfo, report)

View File

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

View File

@ -71,14 +71,14 @@ class TestCaptureManager(object):
capman = CaptureManager(method)
capman.start_global_capturing()
capman.suspend_global_capture()
outerr = capman.snap_global_capture()
outerr = capman.read_global_capture()
assert outerr == ("", "")
capman.suspend_global_capture()
outerr = capman.snap_global_capture()
outerr = capman.read_global_capture()
assert outerr == ("", "")
print("hello")
capman.suspend_global_capture()
out, err = capman.snap_global_capture()
out, err = capman.read_global_capture()
if method == "no":
assert old == (sys.stdout, sys.stderr, sys.stdin)
else:
@ -86,7 +86,7 @@ class TestCaptureManager(object):
capman.resume_global_capture()
print("hello")
capman.suspend_global_capture()
out, err = capman.snap_global_capture()
out, err = capman.read_global_capture()
if method != "no":
assert out == "hello\n"
capman.stop_global_capturing()