Skip to main content

A collection of helpers and mock objects for unit tests and doc tests.

Project description

TestFixtures is a collection of helpers and mock objects that are useful when writing unit tests or doc tests.

If you’re wondering why “yet another mock object library”, testing is often described as an art form and as such some styles of library will suit some people while others will suit other styles. This library contains common test fixtures the author found himself repeating from package to package and so decided to extract them into their own library and give them some tests of their own!

The areas of testing this package can help with are listed below:

Comparing objects and sequences

Better feedback when the results aren’t as you expected along with support for comparison of objects that don’t normally support comparison.

Mocking out objects and methods

Easy to use ways of stubbing out objects, classes or individual methods for both doc tests and unit tests. Special helpers are provided for testing with dates and times.

Testing logging

Helpers for capturing logging output in both doc tests and unit tests.

Testing stream output

Helpers for capturing stream output, such as that from print statements, and making assertion about it.

Testing with files and directories

Support for creating and checking files and directories in sandboxes for both doc tests and unit tests.

Testing exceptions and warnings

Easy to use ways of checking that a certain exception is raised, or a warning is issued, even down the to the parameters provided.

Testing subprocesses

A handy mock for testing code that uses subprocesses.

Testing when using django

Helpers for comparing instances of django models.

Testing when using zope.component

An easy to use sterile component registry.

Project details


Release history Release notifications | RSS feed

This version

6.0.2

Download files

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

Source Distribution

testfixtures-6.0.2.tar.gz (102.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

testfixtures-6.0.2-py2.py3-none-any.whl (77.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file testfixtures-6.0.2.tar.gz.

File metadata

  • Download URL: testfixtures-6.0.2.tar.gz
  • Upload date:
  • Size: 102.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for testfixtures-6.0.2.tar.gz
Algorithm Hash digest
SHA256 f8827cfc91e5cc9ac669727fdd48a85880f391b935a0a212b5cedb807879feec
MD5 8e83031e6e3238652f51be487ad83f37
BLAKE2b-256 588d0cbe2a577cb4d27825d7946514d627e0a40812ac95d587da039f58933004

See more details on using hashes here.

File details

Details for the file testfixtures-6.0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for testfixtures-6.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 04f31490bbebd7b87eae3bc63d1f1056cdcab62c76301b92bf34fc1267ffc367
MD5 fd8f23ab735d2492987e8aec764a9a3d
BLAKE2b-256 0c9c1553817d5e60073a38256a36337f92cd250e7198eac8d816985baf3a8175

See more details on using hashes here.

Supported by

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