Projects / CaptureMock


CaptureMock provides capture-replay mocking for Python, on the command line and with client-server communication. CaptureMock's approach is a so-called capture-replay approach. This means that when you 'record' your mock, CaptureMock will observe the interaction between your code and the subsystem you are mocking out, and record it in a text file in its own format. When you then run your test in 'replay mode', CaptureMock can play the role of the subsystem in question, and the real subsystem does not need to even be installed. You can then choose, each time you run your tests, whether you wish to have the real subsystems present and verify/recreate the captured mocks, or to rely on the mocks captured by a previous run. If you are running in 'replay mode' and CaptureMock does not receive the same calls as previously, it will fail the test, and suggest that you may want to recreate the mocks in record mode.

Operating Systems

Recent releases

  •  03 Apr 2014 20:00

    Release Notes: This release supports Python callbacks, making it possible to, for example, intercept Tkinter and use CaptureMock for a limited kind of GUI testing. Many bugs have been fixed since the last release. It should work better in Python 3. Much effort has been spent on making the mock files easier to read and understand. The Client-server support now handles XMLRPC servers.

    •  12 Nov 2011 21:34

      Release Notes: This release supports "inheriting across the interception boundary", i.e., having your non-intercepted code inherit from classes you're intercepting. Traffic alterations ("alterations" in the RC file) are now also enabled on traffic from custom clients. Bugfixes have been made.

      •  08 Jun 2011 19:04

        Release Notes: Bugs were fixed. A new mechanism whereby custom clients can be written in languages other than Python was added.

        •  08 Apr 2011 18:37

          Release Notes: A single bugfix that makes it usable from nosetests and possibly also unittest2.


          Project Spotlight


          A Fluent OpenStack client API for Java.


          Project Spotlight

          TurnKey TWiki Appliance

          A TWiki appliance that is easy to use and lightweight.