flexmock - Testing Library¶
Authors: Slavek Kabrda, Herman Sheremetyev Version: 0.10.10 Homepage: flexmock Homepage Contribute: flexmock on Github Download: http://pypi.python.org/pypi/flexmock License: FreeBSD-style License Issue tracker: Issue Tracker
flexmock is a testing 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.
As a result, Python flexmock removes a number of redundancies in the Ruby flexmock API, alters some defaults, and introduces a number of Python-only features.
flexmock’s design focuses on simplicity and intuitivenes. 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.
Installation¶
$ sudo easy_install flexmock
Or download the tarball, unpack it and run:
$ sudo python setup.py install
Compatibility¶
Tested to work with:
- python 2.7
- python 3.4
- python 3.5
- python 3.6
- python 3.7
- pypy
- pypy3
Automatically integrates with all major test runners, including:
- unittest
- unittest2
- nose
- py.test
- django
- twisted / trial
- doctest
- zope.testrunner
- subunit
- testtools
Start Here¶
API¶
Changelog¶
- Changelog
- Release 0.10.10
- Release 0.10.9
- Release 0.10.8
- Release 0.10.7
- Release 0.10.6
- Release 0.10.5
- Release 0.10.4
- Release 0.10.3
- Release 0.10.2
- Release 0.10.1
- Release 0.10.0
- Release 0.9.7
- Release 0.9.6
- Release 0.9.5
- Release 0.9.4
- Release 0.9.3
- Release 0.9.2
- Release 0.9.1
- Release 0.9.0
- Release 0.8.1
- Release 0.8.0
- Release 0.7.4.2
- Release 0.7.4.1
- Release 0.7.4
- Release 0.7.3
- Release 0.7.2
- Release 0.7.1
- Release 0.7.0
- Release 0.6.9
- Release 0.6.8
- Release 0.6.7
- Release 0.6.6
- Release 0.6.5
- Release 0.6.4
- Release 0.6.3
- Release 0.6.2
- Release 0.6.1
- Release 0.6
- Release 0.5
- Release 0.4
- Release 0.3
Comparison¶
- Mock Library Comparison
- (flexmock for Mox or Mock users.)
- Simple fake object (attributes only)
- Simple fake object (with methods)
- Simple mock
- Creating partial mocks
- Ensure calls are made in specific order
- Raising exceptions
- Override new instances of a class
- Verify a method was called multiple times
- Mock chained methods
- Mock context manager
- Mocking the builtin open used as a context manager
- (flexmock for Mox or Mock users.)