Skip to main content

Mock/Stub/Spy library for Python

Project description

FlexMock is a mock/stub/spy library for Python.

It takes inspiration from a Ruby library of the same name, and as a result introduces much simpler syntax than other Python mocking libraries that are largely ported from Java. The aim of Python FlexMock is to be able to provide full support for mocking Python-specific features, and make the creation of fake objects as unobtrusive as possible.

More details, along with comparisons to other Python mocking libraries, are available here:

https://github.com/has207/flexmock/wiki/Why-Flexmock%3F

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:

https://github.com/has207/flexmock/blob/master/CHANGELOG

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flexmock-0.7.1.tar.gz (7.2 kB view details)

Uploaded Source

File details

Details for the file flexmock-0.7.1.tar.gz.

File metadata

  • Download URL: flexmock-0.7.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for flexmock-0.7.1.tar.gz
Algorithm Hash digest
SHA256 9c3f718a1b4445acfefe7a04349748a4ffa3f4c270b496298174af8a7783cb80
MD5 e979a055d627d8b90849df3036d213c9
BLAKE2b-256 421dba51a6dc0eb3b4f0ae23c1b8ff171d187bd31fe9452f0484cd97ced575e2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page