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

  • official package (may be outdated)

  • amateur repository: deb http://pike.esi.uclm.es/arco/ sid main (always updated)

  • 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.2.tar.gz (14.7 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: doublex-1.9.2.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for doublex-1.9.2.tar.gz
Algorithm Hash digest
SHA256 4e9f17f346276db7faa461dfa105f17de7f837e5ceccca34f4c70d4ff9d2f20c
MD5 188eace646b4f31d72a53fb1f1f444c0
BLAKE2b-256 b1d3592155ee9c7486ea3ff4071d1bd6de6c4606c621b3fa8849520aef7ca3ce

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