Skip to content

ghsang/dockontext

Repository files navigation

dockontext

pypi Build Status codecov

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published