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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for pytest_docker_tools-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e94e1eaaacf71eaa1419e6fd58bad4cae0a292315f3d79ab4f738444ac0d1da |
|
MD5 | 09b5498f007726767af8aea8d63b9e89 |
|
BLAKE2b-256 | 20845e2e1c776fa13025145efa74c444bd05c3b4661715debd463eb6ab5cb9e3 |
Close
Hashes for pytest_docker_tools-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbbcedc816c0e0ccd3bf71e45d7ee1b3b1ed87922b6662c15c5d3eb6700fae65 |
|
MD5 | 1b234d01fc0620c9eff76f8f009548b5 |
|
BLAKE2b-256 | d3ae734f02703fb2b4d4d1ad5046664e52329235cac1601424e41964745bcee9 |