Metadata-Version: 2.1
Name: pytest-dynamodb
Version: 2.1.0
Summary: DynamoDB fixtures for pytest
Home-page: https://github.com/ClearcodeHQ/pytest-dynamodb
Maintainer: Grzegorz Śliwiński
Maintainer-email: fizyk+pypi@fizyk.net.pl
License: LGPLv3+
Keywords: tests,py.test,pytest,fixture,dynamodb,aws,boto
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Testing
Classifier: Framework :: Pytest
Requires-Python: >=3.7
Description-Content-Type: text/x-rst
Provides-Extra: tests
License-File: COPYING.lesser
License-File: COPYING
License-File: AUTHORS.rst

.. image:: https://raw.githubusercontent.com/ClearcodeHQ/pytest-dynamodb/master/logo.png
    :width: 100px
    :height: 100px
    
pytest-dynamodb
===============

.. image:: https://img.shields.io/pypi/v/pytest-dynamodb.svg
    :target: https://pypi.python.org/pypi/pytest-dynamodb/
    :alt: Latest PyPI version

.. image:: https://img.shields.io/pypi/wheel/pytest-dynamodb.svg
    :target: https://pypi.python.org/pypi/pytest-dynamodb/
    :alt: Wheel Status

.. image:: https://img.shields.io/pypi/pyversions/pytest-dynamodb.svg
    :target: https://pypi.python.org/pypi/pytest-dynamodb/
    :alt: Supported Python Versions

.. image:: https://img.shields.io/pypi/l/pytest-dynamodb.svg
    :target: https://pypi.python.org/pypi/pytest-dynamodb/
    :alt: License

Package status
--------------

.. image:: https://travis-ci.org/ClearcodeHQ/pytest-dynamodb.svg?branch=v2.1.0
    :target: https://travis-ci.org/ClearcodeHQ/pytest-dynamodb
    :alt: Tests

.. image:: https://coveralls.io/repos/ClearcodeHQ/pytest-dynamodb/badge.png?branch=v2.1.0
    :target: https://coveralls.io/r/ClearcodeHQ/pytest-dynamodb?branch=v2.1.0
    :alt: Coverage 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
==========

.. warning::

    Please download the `DynamoDB database locally <http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html>`_.

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:


.. code-block:: python

    from pytest_dynamodb import factories

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

.. note::

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


Configuration
=============

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``

.. list-table:: Configuration options
   :header-rows: 1

   * - 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
     - 127.0.0.1
   * - port
     - port
     - --dynamodb-port
     - dynamodb_port
     - random
   * - AWS Access Key
     - access_key
     - --dynamodb-aws_access_key
     - dynamodb_aws_access_key
     - access_key
   * - AWS Secret Key
     - secret_key
     - --dynamodb-aws_secret_key
     - dynamodb_aws_secret_key
     - secret_key
   * - AWS Region
     - region
     - --dynamodb-aws_region
     - dynamodb_aws_region
     - us-west-1
   * - `Introduce delays <http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html)>`_
     - delay
     - --dynamodb-delay
     - dynamodb_delay
     - false


Example usage:

* pass it as an argument in your own fixture

    .. code-block:: python

        dynamodb_proc = factories.dynamodb_proc(
            port=8888)

* use ``--dynamodb-port`` command line option when you run your tests

    .. code-block::

        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``:

    .. code-block:: ini

        [pytest]
        dynamodb_port = 8888

Package resources
-----------------

* Bug tracker: https://github.com/ClearcodeHQ/pytest-dynamodb/issues

CHANGELOG
=========

2.1.0
----------

Misc
++++

- Rely on `get_port` functionality delivered by `port_for`
- Migrate CI to github actions
- Support only python 3.7 and up

2.0.1
-------

Bugfix
++++++

- Adjust for mirakuru 2.2.0 and up

2.0.0
-------

- [feature] Drop support for python 2.7. From now on, only support python 3.6 and up

1.2.0
-------

- [enhancement] ability to configure aws region and credentials,

    .. note::

        apparently local dynamo operates on these so whatever you'll set when creating table,
        is whatever is required when accessing the table

1.1.1
-------

- [enhancement] removed path.py dependency

1.1.0
-------

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

1.0.1
-------

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

1.0.0
-------

- 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


