Flexmock is a mock/stub/spy library for Python. Its API is inspired by a Ruby library of the same name. However, it is not a goal of Python Flexmock to be a clone of the Ruby version. Instead, the focus is on providing full support for testing Python programs and making the creation of fake objects as unobtrusive as possible. Flexmocks design focuses on simplicity and intuitiveness. This means that the API is as lean as possible, though a few convenient short-hand methods are provided to aid brevity and readability. Flexmock declarations are structured to read more like English sentences than API calls, and it is possible to chain them together in any order to achieve high degree of expressiveness in a single line of code.
|Tags||Mock mocking mocks Stub Stubs stubbing Testing|
Release Notes: This release fixes static method mocking on instances, comparison of kwargs ordering, and ReturnValue string representation. Argument signatures on Mock objects are no longer enforced.
Release Notes: This release adds support for stubbing return values on getter properties and non-callable attributes. It also adds custom matcher object support to with_args(), stricter function signature checks, support for chained attributes, and iter support to Mock objects. should_call() is fixed to work with class mocks, and_return() is fixed to return None by default, and partial mocks created using the func=return_value style will now use replace_with() instead of should_receive() for callable values. As of this release, flexmock is also tested as working on PyPy and Jython.
Release Notes: This release adds python 3.3 as a tested target, proper handling of ordered() expectations across different methods, and property support on fake objects. It fixes compatibility with pytest 2.2, a bug with mocking subclasses of str class, a bug in tuple handling when formatting arguments, and a bug with reseting subclass methods.
Release Notes: This release fixes mocking builtins by resetting expectations when exceptions are raised during flexmock setup. It fixes mocking private methods on classes with leading underscores in the name. It limits the damage of "from flexmock import *" by restricting it to only import the flexmock() function. It fixes a subtle error by ensuring global success status is cleaned up after each test.
Release Notes: This release adds support for a number of popular test runners, including unittest2, django/trial, twisted, zope.testrunner, subunit, and testtools.