Skip to main content

Python unittest.TestCase for testing the output of standard stream(stdout, stderr)

Project description

forthebadge

Build Status Coverage Status

Overview

The streamtest provides the enhanced unittest.TestCase for testing the output of standard stream (stdout, stderr).

Usage

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 git@github.com:alice1017/streamtest.git
$ cd streamtest
$ python setup.py build install

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamtest-1.0b1.tar.gz (2.5 kB view hashes)

Uploaded source

Built Distribution

streamtest-1.0b1-py2.7.egg (5.0 kB view hashes)

Uploaded 2 7

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page