Skip to content

Commit

Permalink
Merge pull request #510 from SUSE/deprecations
Browse files Browse the repository at this point in the history
Remove container_from_pytest_param deprecated use
  • Loading branch information
dirkmueller authored Jun 19, 2024
2 parents 3b85392 + 65ea0e2 commit c884b5f
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
5 changes: 2 additions & 3 deletions bci_tester/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
]
Expand Down
4 changes: 2 additions & 2 deletions tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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__
Expand Down
6 changes: 4 additions & 2 deletions tests/test_kernel_module.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions tests/test_openjdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions tests/test_php.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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"""
Expand Down
4 changes: 2 additions & 2 deletions tests/test_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions tests/test_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)],
),
Expand All @@ -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,
Expand Down

0 comments on commit c884b5f

Please sign in to comment.