From a824b1755f3d9d5a49c8187bdeeaeb067860ead0 Mon Sep 17 00:00:00 2001 From: KK Date: Thu, 15 Jun 2023 16:33:24 +0200 Subject: [PATCH] fixed merge error --- test/integration/conftest.py | 17 +++++++++++++++++ test/integration/test_ssh_access.py | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/test/integration/conftest.py b/test/integration/conftest.py index 4d07f7822..8df54e7e0 100644 --- a/test/integration/conftest.py +++ b/test/integration/conftest.py @@ -3,6 +3,7 @@ import pytest +from exasol_integration_test_docker_environment.lib.docker import ContextDockerClient from exasol_integration_test_docker_environment.testing import utils from exasol_integration_test_docker_environment \ .testing.api_test_environment import ApiTestEnvironment @@ -100,3 +101,19 @@ def create_context( utils.close_environments(spawned) return create_context + + +def exact_matcher(names): + return lambda value: all(x == value for x in names) + + +def superset_matcher(names): + return lambda value: all(x in value for x in names) + + +@contextlib.contextmanager +def container_named(*names, matcher=None): + matcher = matcher if matcher else exact_matcher(names) + with ContextDockerClient() as client: + matches = [c for c in client.containers.list() if matcher(c.name)] + yield matches[0] if matches else None diff --git a/test/integration/test_ssh_access.py b/test/integration/test_ssh_access.py index 44a3c3c6d..720c17a47 100644 --- a/test/integration/test_ssh_access.py +++ b/test/integration/test_ssh_access.py @@ -3,7 +3,7 @@ import os import pytest -from conftest import container_named +from .conftest import container_named from exasol_integration_test_docker_environment.lib.base.ssh_access import SshKey, SshKeyCache