context manager that runs and closes docker containers
Project description
dockontext
context manager that runs and closes docker containers
- When integration or end-to-end test needs temporal docker container to fake remote systems, this package will help to create/close/remove the temporal docker container.
Features
- Create docker container by giving image name. The container will be named as 'docontext={name}'
- Close and remove the container when exit.
Example
pytest.fixture
import pytest
from dockontext import container_generator_from_image, Result, Config
create_container = pytest.fixture(container_generator_from_image)
def test_fixture(create_container):
config = Config(name, "alpine:latest")
container = create_container(config)
result = container.execute("echo hello", timeout: float)
assert result == Result(returncode=0, stdout="hello\n", stderr="")
TODO
- Dockerfile
- docker-compose.yml
- container group context
Free software: MIT License
Credits
- This package was created with Cookiecutter
- Also was copied and modified from the audreyr/cookiecutter-pypackage project template.
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
dockontext-0.1.3.tar.gz
(4.5 kB
view hashes)
Built Distribution
Close
Hashes for dockontext-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2eea3b4148220fb6b7e4901d8a7c9bda5e5dab5c65eb325049eeeb80ef5188e |
|
MD5 | fc04117349c337705b5ff7fd368fd4b1 |
|
BLAKE2b-256 | b101a1d934ebb3e8154037824e0cdccb7f7e15aed14a4d49d4dba2a92b45b2d9 |