@pytest.fixture
def capfd(request):
 if ('capsys' in request.fixturenames):
  request.raiseerror(error_capsysfderror)
 if (not hasattr(os, 'dup')):
  pytest.skip('capfd funcarg needs os.dup')
 request.node._capfuncarg = c = CaptureFixture(FDCapture, request)
 return c

@ pytest . fixture def capfd ( request ) : if ( 'capsys' in request . fixturenames ) : request . raiseerror ( error_capsysfderror ) if ( not hasattr ( os , 'dup' ) ) : pytest . skip ( 'capfd funcarg needs os.dup' ) request . node . _capfuncarg = c = CaptureFixture ( FDCapture , request ) return c
enable capturing of writes to file descriptors 1 and 2 and make captured output available via capfd .