Skip to main content

Python test doubles

Project description

Latest PyPI version License Supported Python Versions GitHub Actions CI status

Powerful test doubles framework for Python

[ install | docs | changelog | sources | issues | PyPI | github clone ]

a trivial example

import unittest
from doublex import Spy, assert_that, called

class SpyUseExample(unittest.TestCase):
    def test_spy_example(self):
        # given
        spy = Spy(SomeCollaboratorClass)
        cut = YourClassUnderTest(spy)

        # when

        # then
        assert_that(spy.some_method, called())

See more about doublex doubles.


  • doubles have not public API framework methods. It could cause silent misspelling.

  • doubles do not require collaborator instances, just classes, and it never instantiate them.

  • assert_that() is used for ALL assertions.

  • mock invocation order is relevant by default.

  • supports old and new style classes.

  • supports Python versions: 3.6, 3.7, 3.8, 3.9, 3.10


  • amateur repository: deb sid main (always updated)

  • official package (may be outdated)

  • official ubuntu package

  • debian dir: svn://

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

doublex- (15.7 kB view hashes)

Uploaded source

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