Skip to content

Instantly share code, notes, and snippets.

@wshayes
Created April 24, 2019 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wshayes/4e7ae0ea8a582ba9e6468125bddbdaca to your computer and use it in GitHub Desktop.
Save wshayes/4e7ae0ea8a582ba9e6468125bddbdaca to your computer and use it in GitHub Desktop.
Running docker servers in pytest
# Example of code to startup docker containers for use in the tests
# pip install pytest-docker-tools
from pytest_docker_tools import container, fetch
arangodb_image = fetch(repository="arangodb:3.4")
elasticsearch_image = fetch(repository="elasticsearch:6.7.1")
arangodb_session = container(
image="{arangodb_image.id}",
name="pytest_arangodb",
scope="session",
ports={"8529/tcp": 18529},
environment={"ARANGO_NO_AUTH": True},
)
elasticsearch_session = container(
image="{elasticsearch_image.id}",
name="pytest_elasticsearch",
scope="session",
ports={"9200/tcp": 19200},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment