Mock/Stub/Spy library for Python
Project description
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.
What makes FlexMock unique in the Python testing world is its automatic integration with the test runner, allowing for really terse syntax and avoiding both the action->assertion and record->replay paradigms supported by all the other Python mocking libraries currently available. To be sure, you can still write your assertions in the action->assertion mode using FlexMock, but its powerful syntax allows you to define both the expectation and the assertion at the same time.
SUPPORTS:
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
Documentation:
https://github.com/has207/flexmock/wiki/Documentation
Changelog:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file flexmock-0.6.6.tar.gz
.
File metadata
- Download URL: flexmock-0.6.6.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65b86f3103a5882accffce2e65c528b4d5fddc88fdf5e1917766a94245c0e42d |
|
MD5 | 9c8b6893feaf659ffd9087c50994aba5 |
|
BLAKE2b-256 | e928e75521a9980eabd8269969f87da33b306d3d552e134c5f654cee943e3ef7 |