pMock has not been under active development since mid 2004.

For other suitable mocking frameworks see the Cheescake info on python mock testing tools

pMock

pMock is a Python module for testing Python code using mock objects.

...
import pmock
...
class InstrumentTest(unittest.TestCase):
    def test_low_quality_analysis(self):
        analyser_mock = pmock.Mock()
        analyser_mock.expects().analyse(pmock.eq("123")).will(pmock.return_value("30"))
        instrument = Instrument(analyser_mock)
        instrument.insert("sample#123")
        self.assert_(instrument.is_low_quality_indicator_on())
        analyser_mock.verify()
...

Inspired by the Java jMock library, pMock makes the writing of unit tests using mock object techniques easier.

The typical sequence of steps in a test involving pMock mock objects are: See the overview for an introduction on how to use pMock in your unit tests.

Requirements

Download

pmock 0.3

Documentation

Development

Sourceforge project page

Browse the source in CVS

Author: Graham Carlyle (grahamcarlyle at users dot sourceforge dot net)

SourceForge.net Logo