Skip to main content

A set of tools for creating declarative docker py.test integration fixtures.

Project description

pytest-docker-tools

This package contains some opinionated helpers for Dockerized integration testing drive by py.test.

You can define your fixtures in your conftest.py or in the test module where you are using them.

A simple example of a container built from an image with a volume attached:

from pytest_docker_tools.factories import *

container(
    'my_microservice',
    image('my_microservice_image', path='.'),
    volumes={
      volume('my_microservice_data'): {'bind': '/var/tmp'},
    }
)

Wherever possible the arguments to container_fixture mirror the arguments to the python docker libraries run() API.

You can create containers that depend on other containers:

from pytest_docker_tools.factories import *

container(
    'my_database',
    image('my_database_image', path='db'),
    volumes={
      volume('my_microservice_data'): {'bind': '/var/tmp'},
    }
)

container(
    'my_microservice',
    image('my_microservice_image', path='microservice'),
    environment={
      'DATABASE_IP': lambda my_database: my_database['ip'],
    }
)

Whenever you create a test that uses the my_microservice container it will also start a database container.

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

pytest_docker_tools-0.0.2.tar.gz (7.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pytest_docker_tools-0.0.2-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

pytest_docker_tools-0.0.2-py2.py3-none-any.whl (20.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pytest_docker_tools-0.0.2.tar.gz.

File metadata

File hashes

Hashes for pytest_docker_tools-0.0.2.tar.gz
Algorithm Hash digest
SHA256 3e94e1eaaacf71eaa1419e6fd58bad4cae0a292315f3d79ab4f738444ac0d1da
MD5 09b5498f007726767af8aea8d63b9e89
BLAKE2b-256 20845e2e1c776fa13025145efa74c444bd05c3b4661715debd463eb6ab5cb9e3

See more details on using hashes here.

File details

Details for the file pytest_docker_tools-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_docker_tools-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dbbcedc816c0e0ccd3bf71e45d7ee1b3b1ed87922b6662c15c5d3eb6700fae65
MD5 1b234d01fc0620c9eff76f8f009548b5
BLAKE2b-256 d3ae734f02703fb2b4d4d1ad5046664e52329235cac1601424e41964745bcee9

See more details on using hashes here.

File details

Details for the file pytest_docker_tools-0.0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_docker_tools-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 75df6fdcd99f6a368ce7cc7792bb71d74a6b8ba99cd002351c1fd58f7157b596
MD5 ff69043cc0b4182876f56d7cbc9797aa
BLAKE2b-256 b9cf47b07e2110294bec4443c3c0b7bb2e61c7eaf9226632bf88ecc49e9a908c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_docker_tools-0.0.2-py2.py3-none-any.whl:

Publisher: ci.yml on Jc2k/pytest-docker-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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