Registry / testing / mocker

mocker

JSON →
library1.1.1pypypiunverified

Graceful platform for test doubles in Python (mocks, stubs, fakes, and dummies). Version 1.1.1, stable but rarely updated.

pip install mocker
INSTALL
IMPORT
SIG · MOCKER
M
mocker
testingpythonv1.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Mocker
from mocker import Mocker
from mocker import Mocker

Basic mock creation and expectation example.

from mocker import Mocker, expect mocker = Mocker() mock = mocker.mock() expect(mock.method()).result('hello') mocker.replay() result = mock.method() print(result) # 'hello' mocker.verify() mocker.restore()
Debug
Known issues
deprecatedLibrary is mostly unmaintained; consider using unittest.mock or pytest-mock instead.
fix
Use unittest.mock from stdlib or pytest-mock integration.
affects: all
gotchaForgetting to call mocker.restore() after tests can leak state into other tests.
fix
Always call mocker.restore() in teardown, preferably via context manager.
affects: all
breakingmocker.replay() must be called before exercising the mock; calling methods before replay raises MockerError.
fix
Call mocker.replay() after setting expectations and before using the mock.
affects: all
Upgrade
Version history
1.1.1latest on PyPI · released May 25, 2012
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
12
Resources
mocker — pip install mocker · libregistry