https://github.com/alice1017/streamtest
Python unittest.TestCase for testing the output of standard stream(stdout, stderr).
https://github.com/alice1017/streamtest
Last synced: about 1 month ago
JSON representation
Python unittest.TestCase for testing the output of standard stream(stdout, stderr).
- Host: GitHub
- URL: https://github.com/alice1017/streamtest
- Owner: alice1017
- Created: 2018-05-11T05:30:54.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-11T05:52:51.000Z (about 7 years ago)
- Last Synced: 2025-03-15T11:50:22.663Z (2 months ago)
- Language: Python
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
streamtest - unit test the output of standard stream
====================================================|forthebadge|
|Build Status| |Coverage Status|
Overview
--------The **streamtest** provides the enhanced ``unittest.TestCase`` for
testing the **output of standard stream** (``stdout``, ``stderr``).Usage
-----.. code:: python
from stramtest import CatchStreamTestCase
class StreamTestCase(CatchStreamTestCase):
def test_stdout(self):
with self.catch_stream("stdout") as stream:
print "hello world"self.assertEqual(stream, "hello world\n")
def test_stderr(self):
with self.catch_stream("stderr") as stream:
sys.stderr.write("Error!")self.assertEqual(stream, "Error!")
Installation
------------::
$ pip install streamtest
or
::
$ git clone [email protected]:alice1017/streamtest.git
$ cd streamtest
$ python setup.py build install.. |forthebadge| image:: http://forthebadge.com/images/badges/made-with-python.svg
:target: http://forthebadge.com
.. |Build Status| image:: https://travis-ci.org/alice1017/streamtest.svg?branch=master
:target: https://travis-ci.org/alice1017/streamtest
.. |Coverage Status| image:: https://coveralls.io/repos/github/alice1017/streamtest/badge.svg
:target: https://coveralls.io/github/alice1017/streamtest