From fa6fae153b10320415825b48155d8adec62bb217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Thu, 22 Aug 2024 19:53:49 +0200 Subject: [PATCH] deprecate MultiStageBuild --- CHANGELOG.rst | 3 +++ pytest_container/build.py | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 765c363..c8e6d58 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,9 @@ Breaking changes: - change type of ``OciRuntimeBase.build_command`` from ``List[str]`` to ``Tuple[str, ...]`` +- deprecate :py:class:`~pytest_container.build.MultiStageBuild` in favor + :py:class:`~pytest_container.container.MultiStageContainer` + Improvements and new features: diff --git a/pytest_container/build.py b/pytest_container/build.py index 22d2514..b5a89d7 100644 --- a/pytest_container/build.py +++ b/pytest_container/build.py @@ -15,9 +15,11 @@ from typing import Optional from typing import Union from uuid import uuid4 +import sys from _pytest.config import Config from _pytest.mark.structures import ParameterSet +from deprecation import deprecated from pytest_container.container import Container from pytest_container.container import container_and_marks_from_pytest_param from pytest_container.container import DerivedContainer @@ -25,6 +27,11 @@ from pytest_container.runtime import OciRuntimeBase from pytest_container.runtime import ToParamMixin +if sys.version_info >= (3, 8): + from importlib import metadata +else: + import importlib_metadata as metadata + @dataclass(frozen=True) class GitRepositoryBuild(ToParamMixin): @@ -83,6 +90,12 @@ def test_command(self) -> str: return cd_cmd +@deprecated( + deprecated_in="0.5.0", + removed_in="0.6.0", + current_version=metadata.version("pytest_container"), + details="use MultiStageContainer instead", +) # type: ignore @dataclass class MultiStageBuild: """Helper class to perform multi-stage container builds using the