skip to navigation
skip to content

pytest-dynamodb 1.1.0

DynamoDB fixtures for pytest


Package status

What is this?

This is a pytest plugin, that enables you to test your code that relies on a running DynamoDB Database. It allows you to specify fixtures for DynamoDB process and client (resource in AWS boto terms).

How to use


Please download the DynamoDB database locally.

Plugin contains two fixtures

  • dynamodb - it’s a client/resource fixture that has functional scope. After each test it drops tables in DynamoDB.
  • dynamodb_proc - session scoped fixture, that starts DynamoDB instance at it’s first use and stops at the end of the tests.

Simply include one of these fixtures into your tests fixture list.

You can also create additional dynamodb client and process fixtures if you’d need to:

from pytest_dynamodb import factories

dynamodb_my_proc = factories.dynamodb_proc(
    port=None, logsdir='/tmp', delay=True)
dynamodb_my = factories.dynamodb('dynamodb_my_proc')


Each DynamoDB process fixture can be configured in a different way than the others through the fixture factory arguments.


You can define your settings in three ways, it’s fixture factory argument, command line option and pytest.ini configuration option. You can pick which you prefer, but remember that these settings are handled in the following order:

  • Fixture factory argument
  • Command line option
  • Configuration option in your pytest.ini file
DynamoDB option Fixture factory argument Command line option pytest.ini option Default
Path to dynamodb jar file dynamodb_dir –dynamodb-dir dynamodb_dir /tmp/dynamodb
host host –dynamodb-host dynamodb_host
port port –dynamodb-port dynamodb_port random
Introduce delays delay –dynamodb-delay dynamodb_delay false

Example usage:

  • pass it as an argument in your own fixture

    dynamodb_proc = factories.dynamodb_proc(
  • use --dynamodb-port command line option when you run your tests

    py.test tests --dynamodb-port=8888
  • specify your port as dynamodb_port in your pytest.ini file.

    To do so, put a line like the following under the [pytest] section of your pytest.ini:

    dynamodb_port = 8888



  • [enhancement] change deprecated getfuncargvalaue to getfixturevalues, require at least pytest 3.0.0


  • [enhancements] set executor timeout to 60. By default mirakuru waits indefinitely, which might cause test hangs


  • create command line and pytest.ini configuration options for introducing delays
  • create command line and pytest.ini configuration options for dynamodb_dir
  • create command line and pytest.ini configuration options for host
  • create command line and pytest.ini configuration options for port
  • Extracted code from pytest-dbfixtures
File Type Py Version Uploaded on Size
pytest-dynamodb-1.1.0.tar.gz (md5) Source 2016-11-15 8KB
pytest_dynamodb-1.1.0-py2.py3-none-any.whl (md5) Python Wheel py2.py3 2016-11-15 11KB