Capture stdout, stderr easily.
Project description
.. -*- restructuredtext -*-
.. highlight:: python
.. image:: https://secure.travis-ci.org/oinume/iocapture.png?branch=master
Capture stdout, stderr easily with iocapture.
How to use
==========
With Python >= 2.5 ::
import iocapture
with iocapture.capture() as captured:
print("hello stdout")
print(captured.stdout)
# >>> hello stdout
With Python < 2.5 ::
import iocapture
captured = iocapture.capture()
captured.start()
print("hello stdout")
captured.close()
print(captured.stdout)
# >>> hello stdout
ChangeLog
=========
https://github.com/oinume/blob/master/changes.rst
For developers
==============
Install iocapture in develop mode. ::
pip install -r requirements-dev.txt
Run tests ::
$ py.test tests
.. highlight:: python
.. image:: https://secure.travis-ci.org/oinume/iocapture.png?branch=master
Capture stdout, stderr easily with iocapture.
How to use
==========
With Python >= 2.5 ::
import iocapture
with iocapture.capture() as captured:
print("hello stdout")
print(captured.stdout)
# >>> hello stdout
With Python < 2.5 ::
import iocapture
captured = iocapture.capture()
captured.start()
print("hello stdout")
captured.close()
print(captured.stdout)
# >>> hello stdout
ChangeLog
=========
https://github.com/oinume/blob/master/changes.rst
For developers
==============
Install iocapture in develop mode. ::
Run tests ::
$ py.test tests