Overview

The Test Helpers library exists to consolidate some of the repetition that has arisen in our tests while providing a useful set of generic testing utilities.

This library offers a set of base test cases, testing mixins, and testing utilities to make interacting with third party services, testing metrics generation, and creating mocks or patches easier.

Examples

The library is designed to be simple and modular. By using mixins to extend the test cases functionality we can write more expressive tests in fewer lines of code.

>>> from test_helpers import mixins, bases
>>> class WhenFooingBar(mixins.PatchMixin, bases.BaseTest):
...
...     patch_prefix = 'module.submodule'
...
...     @classmethod
...     def configure(cls):
...         cls.foo = cls.create_patch('foo', return_value=True)
...
...     @classmethod
...     def execute(cls):
...         function_under_test()
...
...     def should_have_called_foo(cls):
...         self.foo.assert_called_once_with()

Documentation

Indices and tables

Release History

  • Next Release
    • Removed Makefile from the development environment.
    • Make overriding execute optional.
  • 1.5.4
    • Relax the pin on the six library
  • 1.5.3
    • test_helpers.postgres module added
    • test_helpers.mongo module added
  • 1.5.2
    • test_helpers.rabbit module added
  • 1.5.1
    • Allow use of mixins module without requiring the tornado package
  • 1.5.0
    • Initial public release.