pi-hole/test/conftest.py
diginc 706e459d04 Adding test to ensure upgrade vars are set, fixed
Modified upgrade variable import to export vars to ensure they stay set in all script scopes and environments
2016-09-13 08:14:35 -05:00

34 lines
797 B
Python

import pytest
import testinfra
DEBUG = []
check_output = testinfra.get_backend(
"local://"
).get_module("Command").check_output
@pytest.fixture
def Docker(request, args, image, cmd):
assert 'docker' in check_output('id'), "Are you in the docker group?"
docker_run = "docker run {} {} {}".format(args, image, cmd)
docker_id = check_output(docker_run)
def teardown():
check_output("docker rm -f %s", docker_id)
request.addfinalizer(teardown)
docker_container = testinfra.get_backend("docker://" + docker_id)
docker_container.id = docker_id
return docker_container
@pytest.fixture
def args(request):
return '-d'
@pytest.fixture()
def image(request):
return 'pytest_pihole'
@pytest.fixture()
def cmd(request):
return 'tail -f /dev/null'