From e0417a65d2edf0bfaab8d3b311f7dfb970abda2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Tue, 18 Jun 2024 18:30:40 +0200 Subject: [PATCH] Remove container_from_pytest_param deprecated use This silences a slightly annoying warning in the test outpu --- bci_tester/data.py | 5 ++--- tests/test_base.py | 4 ++-- tests/test_kernel_module.py | 6 ++++-- tests/test_openjdk.py | 6 +++--- tests/test_php.py | 6 +++--- tests/test_postgres.py | 4 ++-- tests/test_python.py | 6 +++--- 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/bci_tester/data.py b/bci_tester/data.py index 5fed0f7a..af2ce1ca 100755 --- a/bci_tester/data.py +++ b/bci_tester/data.py @@ -7,9 +7,8 @@ from typing import Optional from typing import Sequence -from pytest_container import container_and_marks_from_pytest_param +from pytest_container.container import container_and_marks_from_pytest_param from pytest_container import DerivedContainer -from pytest_container.container import container_from_pytest_param from pytest_container.container import ContainerVolume from pytest_container.container import PortForwarding from pytest_container.runtime import LOCALHOST @@ -841,7 +840,7 @@ def has_xfail(param: ParameterSet) -> bool: print( json.dumps( [ - container_from_pytest_param(cont).get_base().url + container_and_marks_from_pytest_param(cont)[0].get_base().url for cont in ALL_CONTAINERS if (not has_true_skipif(cont) and not has_xfail(cont)) ] diff --git a/tests/test_base.py b/tests/test_base.py index dc7ed3dd..fe2d1964 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -7,7 +7,7 @@ import pytest from pytest_container import DerivedContainer -from pytest_container.container import container_from_pytest_param +from pytest_container.container import container_and_marks_from_pytest_param from pytest_container.container import ContainerData from pytest_container.runtime import LOCALHOST @@ -186,7 +186,7 @@ def test_all_openssl_hashes_known(auto_container): #: that docker can be launched inside the container DIND_CONTAINER = pytest.param( DerivedContainer( - base=container_from_pytest_param(BASE_CONTAINER), + base=container_and_marks_from_pytest_param(BASE_CONTAINER)[0], **{ x: getattr(BASE_CONTAINER.values[0], x) for x in BASE_CONTAINER.values[0].__dict__ diff --git a/tests/test_kernel_module.py b/tests/test_kernel_module.py index aaa8096c..6af5d514 100644 --- a/tests/test_kernel_module.py +++ b/tests/test_kernel_module.py @@ -1,7 +1,7 @@ """Tests for the SLE15 kernel-module container.""" import pytest -from pytest_container import container_from_pytest_param +from pytest_container import container_and_marks_from_pytest_param from pytest_container import DerivedContainer from pytest_container.container import ContainerData from pytest_container.runtime import LOCALHOST @@ -22,7 +22,9 @@ def create_kernel_test(containerfile: str) -> pytest.param: return pytest.param( DerivedContainer( - base=container_from_pytest_param(KERNEL_MODULE_CONTAINER), + base=container_and_marks_from_pytest_param( + KERNEL_MODULE_CONTAINER + )[0], containerfile=containerfile, ), marks=KERNEL_MODULE_CONTAINER.marks, diff --git a/tests/test_openjdk.py b/tests/test_openjdk.py index 85aa1404..deb361c6 100644 --- a/tests/test_openjdk.py +++ b/tests/test_openjdk.py @@ -9,7 +9,7 @@ import pytest from pytest_container import DerivedContainer from pytest_container import Version -from pytest_container.container import container_from_pytest_param +from pytest_container.container import container_and_marks_from_pytest_param from pytest_container.container import ContainerData from pytest_container.runtime import LOCALHOST @@ -38,7 +38,7 @@ CONTAINER_IMAGES_EXTENDED = [ pytest.param( DerivedContainer( - base=container_from_pytest_param(container), + base=container_and_marks_from_pytest_param(container)[0], containerfile=DOCKERF_EXTENDED, ), marks=container.marks, @@ -50,7 +50,7 @@ CONTAINER_IMAGES_CASSANDRA = [ pytest.param( DerivedContainer( - base=container_from_pytest_param(container), + base=container_and_marks_from_pytest_param(container)[0], containerfile=DOCKERF_CASSANDRA, ), marks=container.marks, diff --git a/tests/test_php.py b/tests/test_php.py index 406ac983..4932e3f3 100644 --- a/tests/test_php.py +++ b/tests/test_php.py @@ -6,7 +6,7 @@ from typing_extensions import Literal import pytest -from pytest_container import container_from_pytest_param +from pytest_container import container_and_marks_from_pytest_param from pytest_container import DerivedContainer from pytest_container import OciRuntimeBase from pytest_container.container import ContainerData @@ -34,7 +34,7 @@ _MEDIAWIKI_MAJOR_VERSION = ".".join(_MEDIAWIKI_VERSION.split(".")[:2]) MEDIAWIKI_APACHE_CONTAINER = DerivedContainer( - base=container_from_pytest_param(PHP_8_APACHE), + base=container_and_marks_from_pytest_param(PHP_8_APACHE)[0], forwarded_ports=[PortForwarding(container_port=80)], image_format=ImageFormat.DOCKER, containerfile=f"""ENV MEDIAWIKI_VERSION={_MEDIAWIKI_VERSION} @@ -66,7 +66,7 @@ MEDIAWIKI_FPM_CONTAINER = DerivedContainer( - base=container_from_pytest_param(PHP_8_FPM), + base=container_and_marks_from_pytest_param(PHP_8_FPM)[0], containerfile=f"""ENV MEDIAWIKI_VERSION={_MEDIAWIKI_VERSION} ENV MEDIAWIKI_MAJOR_VERSION={_MEDIAWIKI_MAJOR_VERSION}""" + r""" diff --git a/tests/test_postgres.py b/tests/test_postgres.py index bfc496fe..2ac044fd 100644 --- a/tests/test_postgres.py +++ b/tests/test_postgres.py @@ -7,7 +7,7 @@ import psycopg2 import pytest from _pytest.mark import ParameterSet -from pytest_container.container import container_from_pytest_param +from pytest_container.container import container_and_marks_from_pytest_param from pytest_container.container import ContainerData from pytest_container.container import DerivedContainer @@ -38,7 +38,7 @@ def _generate_test_matrix() -> List[ParameterSet]: params = [] for pg_cont_param in POSTGRESQL_CONTAINERS: - pg_cont = container_from_pytest_param(pg_cont_param) + pg_cont = container_and_marks_from_pytest_param(pg_cont_param)[0] marks = pg_cont_param.marks ports = pg_cont.forwarded_ports params.append( diff --git a/tests/test_python.py b/tests/test_python.py index fed8de5f..2247bd10 100644 --- a/tests/test_python.py +++ b/tests/test_python.py @@ -7,7 +7,7 @@ from pytest_container import DerivedContainer from pytest_container import OciRuntimeBase from pytest_container import PortForwarding -from pytest_container.container import container_from_pytest_param +from pytest_container.container import container_and_marks_from_pytest_param from pytest_container.container import ContainerData from pytest_container.runtime import get_selected_runtime from pytest_container.runtime import LOCALHOST @@ -49,7 +49,7 @@ CONTAINER_IMAGES_T1 = [ pytest.param( DerivedContainer( - base=container_from_pytest_param(CONTAINER_T), + base=container_and_marks_from_pytest_param(CONTAINER_T)[0], containerfile=DOCKERF_PY_T1, forwarded_ports=[PortForwarding(container_port=PORT1)], ), @@ -64,7 +64,7 @@ CONTAINER_IMAGES_T2 = [ pytest.param( DerivedContainer( - base=container_from_pytest_param(CONTAINER_T), + base=container_and_marks_from_pytest_param(CONTAINER_T)[0], containerfile=DOCKERF_PY_T2, ), marks=CONTAINER_T.marks,