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
        cut.a_method_that_call_the_collaborator()

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

See more about doublex doubles.

Features

  • 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

Debian

  • amateur repository: deb https://uclm-arco.github.io/debian sid main (always updated)

  • official package (may be outdated)

  • official ubuntu package

  • debian dir: svn://svn.debian.org/svn/python-modules/packages/doublex/trunk

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-1.9.6.1.tar.gz (15.7 kB view details)

Uploaded Source

File details

Details for the file doublex-1.9.6.1.tar.gz.

File metadata

  • Download URL: doublex-1.9.6.1.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

File hashes

Hashes for doublex-1.9.6.1.tar.gz
Algorithm Hash digest
SHA256 48fbc633598eb913a6eb0c4694f8c040ba57bae9653d45643a84243e0c9f3268
MD5 a5e1446f72cefa02fc28a533ae1bc050
BLAKE2b-256 fe3d0edaecbafa90c19530739467a5dd02c8ebf9968201ab1ff15537ea98422f

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