From 18e12cbd670c1e33e66063fb6bb2c6508e8727f6 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Sat, 25 Jan 2014 19:43:57 +0100 Subject: [PATCH] remove "StdCapture*.call" classmethod because pytest does not use it. --HG-- branch : capsimple1 --- _pytest/capture.py | 16 ---------------- testing/test_capture.py | 31 ------------------------------- 2 files changed, 47 deletions(-) diff --git a/_pytest/capture.py b/_pytest/capture.py index 2ce6fae7f..0ce3637e0 100644 --- a/_pytest/capture.py +++ b/_pytest/capture.py @@ -409,22 +409,6 @@ class EncodedFile(object): class Capture(object): - def call(cls, func, *args, **kwargs): - """ return a (res, out, err) tuple where - out and err represent the output/error output - during function execution. - call the given function with args/kwargs - and capture output/error during its execution. - """ - so = cls() - so.startall() - try: - res = func(*args, **kwargs) - finally: - out, err = so.reset() - return res, out, err - call = classmethod(call) - def reset(self): """ reset sys.stdout/stderr and return captured output as strings. """ if hasattr(self, '_reset'): diff --git a/testing/test_capture.py b/testing/test_capture.py index 24b71b07a..3b235cc0c 100644 --- a/testing/test_capture.py +++ b/testing/test_capture.py @@ -896,17 +896,6 @@ class TestStdCaptureFD(TestStdCapture): assert out == "123" assert err == "abc" - def test_callcapture(self): - def func(x, y): - print (x) - sys.stderr.write(str(y)) - return 42 - - res, out, err = capture.StdCaptureFD.call(func, 3, y=4) - assert res == 42 - assert out.startswith("3") - assert err.startswith("4") - def test_many(self, capfd): def f(): for i in range(10): @@ -977,26 +966,6 @@ def test_capture_no_sys(): capsys.reset() -@needsosdup -def test_callcapture_nofd(): - def func(x, y): - oswritebytes(1, "hello") - oswritebytes(2, "hello") - print (x) - sys.stderr.write(str(y)) - return 42 - - capfd = capture.StdCaptureFD(patchsys=False) - capfd.startall() - try: - res, out, err = capture.StdCapture.call(func, 3, y=4) - finally: - capfd.reset() - assert res == 42 - assert out.startswith("3") - assert err.startswith("4") - - @needsosdup @pytest.mark.parametrize('use', [True, False]) def test_fdcapture_tmpfile_remains_the_same(tmpfile, use):