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

View File

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

View File

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

View File

@ -71,14 +71,14 @@ class TestCaptureManager(object):
capman = CaptureManager(method) capman = CaptureManager(method)
capman.start_global_capturing() capman.start_global_capturing()
capman.suspend_global_capture() capman.suspend_global_capture()
outerr = capman.snap_global_capture() outerr = capman.read_global_capture()
assert outerr == ("", "") assert outerr == ("", "")
capman.suspend_global_capture() capman.suspend_global_capture()
outerr = capman.snap_global_capture() outerr = capman.read_global_capture()
assert outerr == ("", "") assert outerr == ("", "")
print("hello") print("hello")
capman.suspend_global_capture() capman.suspend_global_capture()
out, err = capman.snap_global_capture() out, err = capman.read_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:
@ -86,7 +86,7 @@ class TestCaptureManager(object):
capman.resume_global_capture() capman.resume_global_capture()
print("hello") print("hello")
capman.suspend_global_capture() capman.suspend_global_capture()
out, err = capman.snap_global_capture() out, err = capman.read_global_capture()
if method != "no": if method != "no":
assert out == "hello\n" assert out == "hello\n"
capman.stop_global_capturing() capman.stop_global_capturing()