nose: nose.proxy

The result proxy wraps the result instance given to each test. It performs two functions: enabling extended error/failure reporting and calling plugins.

As each result event is fired, plugins are called with the same event; however, plugins are called with the nose.case.Test instance that wraps the actual test. So when a test fails and calls result.addFailure(self, err), the result proxy calls addFailure(self.test, err) for each plugin. This allows plugins to have a single stable interface for all test types, and also to manipulate the test object itself by setting the test attribute of the nose.case.Test that they receive.

Classes

Highlighted methods are defined in this class.

ResultProxyFactory (object)

Factory for result proxies. Generates a ResultProxy bound to each test and the result passed to the test.

Methods

__call__(self, result, test)

Return a ResultProxy for the current test.

On first call, plugins are given a chance to replace the result used for the remaining tests. If a plugin returns a value from prepareTestResult, that object will be used as the result for all tests.

__init__(self, config=None)
ResultProxy (object)

Proxy to TestResults (or other results handler).

One ResultProxy is created for each nose.case.Test. The result proxy calls plugins with the nose.case.Test instance (instead of the wrapped test case) as each result call is made. Finally, the real result method is called with the wrapped test.

Methods

__init__(self, result, test, config=None)
addError(self, test, err)
addFailure(self, test, err)
addSuccess(self, test)
afterTest(self, test)
assertMyTest(self, test)
beforeTest(self, test)
get_shouldStop(self)
set_shouldStop(self, shouldStop)
startTest(self, test)
stop(self)
stopTest(self, test)

Attributes

shouldStop
Default value: (property)

Should the test run stop?

Attributes

log
Default value: <logging.Logger instance>