Registry / testing / pytest-mockito

pytest-mockito

JSON →
library0.0.6.post1pypypiunverified

Base fixtures for using Mockito mocks with pytest. Integrates the Mockito library (a spy/mock framework) into pytest by providing fixtures that handle setup and teardown of mocks. Current version is 0.0.6.post1, with a slow release cadence.

pip install pytest-mockito
INSTALL
IMPORT
SIG · PYTEST-MOCKITO
P
pytest-mockito
testingpythonv0.0.6.post1
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
def test_foo(mocker): ...
from pytest_mockito import mocker
mocker is a pytest fixture, not a direct import. Always use as a test function parameter.

Basic test using the mocker fixture to reset mockito state automatically.

import pytest from mockito import when, verify def test_example(mocker): obj = {'foo': 'bar'} when(obj).__getitem__('foo').thenReturn('mocked') assert obj['foo'] == 'mocked' verify(obj).__getitem__('foo')
Debug
Known issues
gotchaThe mocker fixture must be used in every test that uses Mockito mocks; otherwise, mock state leaks between tests.
fix
Add mocker as a parameter to your test function: def test_foo(mocker):
affects: all
gotchaDo not import mocker from pytest-mockito; it is a pytest fixture that must be injected by name.
fix
Use def test(mocker): ... and let pytest inject the fixture.
affects: all
deprecatedThe package has seen no recent updates (last release 0.0.6.post1). It may rely on older versions of mockito. Check compatibility if using mockito 1.4+.
fix
Pin mockito to version compatible with this plugin, or consider pytest-mock or unittest.mock.
affects: >=0.0.6
Upgrade
Version history
0.0.6.post1latest on PyPI · released Feb 10, 2026
Audit
Dependencies
pytestrequiredPytest plugin
mockitorequiredCore mocking library
Agent activity
2 hits · last 30 days
node
2
Resources
pytest-mockito — pip install pytest-mockito · libregistry