Skip to content

Commit 18e12cb

Browse files
committed
remove "StdCapture*.call" classmethod because pytest does not use it.
--HG-- branch : capsimple1
1 parent 3cf4e13 commit 18e12cb

File tree

2 files changed

+0
-47
lines changed

2 files changed

+0
-47
lines changed

_pytest/capture.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -409,22 +409,6 @@ def __getattr__(self, name):
409409

410410

411411
class Capture(object):
412-
def call(cls, func, *args, **kwargs):
413-
""" return a (res, out, err) tuple where
414-
out and err represent the output/error output
415-
during function execution.
416-
call the given function with args/kwargs
417-
and capture output/error during its execution.
418-
"""
419-
so = cls()
420-
so.startall()
421-
try:
422-
res = func(*args, **kwargs)
423-
finally:
424-
out, err = so.reset()
425-
return res, out, err
426-
call = classmethod(call)
427-
428412
def reset(self):
429413
""" reset sys.stdout/stderr and return captured output as strings. """
430414
if hasattr(self, '_reset'):

testing/test_capture.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -896,17 +896,6 @@ def test_intermingling(self):
896896
assert out == "123"
897897
assert err == "abc"
898898

899-
def test_callcapture(self):
900-
def func(x, y):
901-
print (x)
902-
sys.stderr.write(str(y))
903-
return 42
904-
905-
res, out, err = capture.StdCaptureFD.call(func, 3, y=4)
906-
assert res == 42
907-
assert out.startswith("3")
908-
assert err.startswith("4")
909-
910899
def test_many(self, capfd):
911900
def f():
912901
for i in range(10):
@@ -977,26 +966,6 @@ def test_capture_no_sys():
977966
capsys.reset()
978967

979968

980-
@needsosdup
981-
def test_callcapture_nofd():
982-
def func(x, y):
983-
oswritebytes(1, "hello")
984-
oswritebytes(2, "hello")
985-
print (x)
986-
sys.stderr.write(str(y))
987-
return 42
988-
989-
capfd = capture.StdCaptureFD(patchsys=False)
990-
capfd.startall()
991-
try:
992-
res, out, err = capture.StdCapture.call(func, 3, y=4)
993-
finally:
994-
capfd.reset()
995-
assert res == 42
996-
assert out.startswith("3")
997-
assert err.startswith("4")
998-
999-
1000969
@needsosdup
1001970
@pytest.mark.parametrize('use', [True, False])
1002971
def test_fdcapture_tmpfile_remains_the_same(tmpfile, use):

0 commit comments

Comments
 (0)