Skip to main content

Python test doubles

Project description

Latest PyPI version License Supported Python Versions Travis CI status

Powerful test doubles framework for Python

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

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: 2.6, 2.7, 3.3, 3.4, 3.5. 3.6, 3.7

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

Uploaded Source

File details

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

File metadata

  • Download URL: doublex-1.9.3.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.9.1rc1

File hashes

Hashes for doublex-1.9.3.tar.gz
Algorithm Hash digest
SHA256 cf2f45582f706b49643700809f748b5e904e75f35a2b049e9edad92fcb41b6b0
MD5 3c89b7e75029c21b17f149c521b4d1c8
BLAKE2b-256 d98ec4d1a6c37aa08b37a2417a4b904dd052b6b3da8df4e0addf086d6dbfcd91

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