Mock/Stub/Spy library for Python
FlexMock provides a mock/stub/spy library for Python.
It is inspired by Ruby’s FlexMock, however full feature parity with the Ruby version is not a goal. Python FlexMock omits a number of things in the Ruby version, mainly various shortcuts for existing functionality, and implements a number of things that Ruby’s FlexMock doesn’t support, such as proxying/spying and matching arguments using their classes in addition to values.
Why another mock library for Python?
- test runner integration, i.e. automatic expectation checking on tearDown
- advanced argument matching, including matching types and user-defined classes
- expectations on number of times called, including at_least/at_most
- mocks returning custom values, including different values on successive invokations
- mocks raising custom exceptions
- simple syntax for generating new mock objects
- overriding new instances (on new-style objects)
- parameter shortcuts for even terser syntax
- proxying/spying using the and_execute expectation modifier
- mocking a generator using and_yield
- enforcing expectations ordering
Release history Release notifications
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size flexmock-0.7.0.tar.gz (7.4 kB)||File type Source||Python version None||Upload date||Hashes View|