context manager that runs and closes docker containers
Project description
dockontext
context manager that runs and closes docker containers
Features
- 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.
Example
with pytest.fixture
import pytest
from dockontext import container_generator_from_image, Result
docker_context = pytest.fixture(container_generator_from_image)
@pytest.mark.asyncio
async def test_fixture(docker_context):
# container will be created and the name is 'dockontext-{name}'
async with docker_context(name, "alpine:latest") as container:
result = await container.execute(name, timeout: float)
assert result == Result(returncode=0, stdout="hello\n", stderr="")
# container will be stopped and removed here
with contextlib.asynccontextmanager
from contextlib import asynccontextmanager
from dockontext import container_generator_from_image, Result
docker_context = asynccontextmanager(container_generator_from_image)
TODO
- Dockerfile
- docker-compose.yml
- container group context
- get ip
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.0.tar.gz
(4.0 kB
view hashes)
Built Distribution
Close
Hashes for dockontext-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f4c17af3b00a89d71ceda5aaf40d7b10f775431c955c095355d377c8e91dcce |
|
MD5 | b542a13fdf8cc795937b544c0a5d6c78 |
|
BLAKE2b-256 | 900055b134c4b5a2fc3b72d5107e43d3b78915b57066b34aa4b21687db7ac752 |