remove "StdCapture*.call" classmethod because pytest does not use it.

--HG--
branch : capsimple1
This commit is contained in:
holger krekel 2014-01-25 19:43:57 +01:00
parent 3cf4e133cc
commit 18e12cbd67
2 changed files with 0 additions and 47 deletions

View File

@ -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'):

View File

@ -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):