Capture: capture stdout during tests

This plugin captures stdout during test execution. If the test fails or raises an error, the captured output will be appended to the error or failure output. It is enabled by default but can be disabled with the options -s or --nocapture.

Options:
--nocapture

Don’t capture stdout (any stdout output will be printed immediately)

Options

-s, --nocapture

Don’t capture stdout (any stdout output will be printed immediately) [NOSE_NOCAPTURE]

Plugin

class nose.plugins.capture.Capture

Bases: nose.plugins.base.Plugin

Output capture plugin. Enabled by default. Disable with -s or --nocapture. This plugin captures stdout during test execution, appending any output captured to the error or failure output, should the test fail or raise an error.

afterTest(test)

Clear capture buffer.

beforeTest(test)

Flush capture buffer.

begin()

Replace sys.stdout with capture buffer.

buffer

Captured stdout output.

configure(options, conf)

Configure plugin. Plugin is enabled by default.

finalize(result)

Restore stdout.

formatError(test, err)

Add captured output to error report.

formatFailure(test, err)

Add captured output to failure report.

options(parser, env)

Register commandline options

Source

Table Of Contents

Previous topic

Attrib: tag and select tests with attributes

Next topic

Collect: Collect tests quickly

This Page