Skip to content

Commit c2de949

Browse files
committed
tests: docker: move docker import to test function
This way we can correctly skip the tests if the module is not available, otherwise we gat a ModuleNotFoundError because of the unconditional docker import. Signed-off-by: Rouven Czerwinski <[email protected]>
1 parent 881de63 commit c2de949

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/test_docker.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"""
55

66
import pytest
7-
import docker
87
import io
98

109
from labgrid import Environment
@@ -161,6 +160,7 @@ def test_docker_with_daemon(command):
161160

162161
@pytest.fixture
163162
def build_image():
163+
import docker
164164
client = docker.from_env()
165165
dockerfile_content = """
166166
FROM rastasheep/ubuntu-sshd:16.04
@@ -198,6 +198,7 @@ def test_docker_without_daemon(docker_env, mocker):
198198
DockerManager and DockerStrategy without using an actual
199199
docker daemon, real sockets or system time"""
200200

201+
import docker
201202
# Target::update_resources() and Target::await_resources use
202203
# time.monotonic() and time.sleep() to control when to search
203204
# for resources. Avoid time delays and make running from cmd-line

0 commit comments

Comments
 (0)