Skip to content

Commit 6c512cc

Browse files
committed
Convert OciRuntimeBase.build_command from List -> Tuple
1 parent 0d7a6ed commit 6c512cc

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Next Release
33

44
Breaking changes:
55

6+
- change type of ``OciRuntimeBase.build_command`` from ``List[str]`` to
7+
``Tuple[str, ...]``
8+
69

710
Improvements and new features:
811

pytest_container/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def run_build_step(
223223
with tempfile.TemporaryDirectory() as tmp_dir:
224224
iidfile = join(tmp_dir, str(uuid4()))
225225
cmd = (
226-
runtime.build_command
226+
[*runtime.build_command]
227227
+ (extra_build_args or [])
228228
+ [f"--iidfile={iidfile}"]
229229
+ (["--target", target] if target else [])

pytest_container/runtime.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from typing import Callable
1818
from typing import List
1919
from typing import Optional
20+
from typing import Tuple
2021
from typing import TYPE_CHECKING
2122
from typing import Union
2223

@@ -182,7 +183,7 @@ def __gt__(self, other: Any) -> bool:
182183
@dataclass(frozen=True)
183184
class _OciRuntimeBase:
184185
#: command that builds the Dockerfile in the current working directory
185-
build_command: List[str] = field(default_factory=list)
186+
build_command: Tuple[str, ...] = field(default_factory=tuple)
186187
#: the "main" binary of this runtime, e.g. podman or docker
187188
runner_binary: str = ""
188189
_runtime_functional: bool = False
@@ -468,9 +469,9 @@ def _runtime_error_message() -> str:
468469
def __init__(self) -> None:
469470
super().__init__(
470471
build_command=(
471-
["buildah", "bud", "--layers", "--force-rm"]
472+
("buildah", "bud", "--layers", "--force-rm")
472473
if self._buildah_functional
473-
else ["podman", "build", "--layers", "--force-rm"]
474+
else ("podman", "build", "--layers", "--force-rm")
474475
),
475476
runner_binary="podman",
476477
_runtime_functional=self._runtime_functional,
@@ -571,7 +572,7 @@ def _runtime_error_message() -> str:
571572

572573
def __init__(self) -> None:
573574
super().__init__(
574-
build_command=["docker", "build", "--force-rm"],
575+
build_command=("docker", "build", "--force-rm"),
575576
runner_binary="docker",
576577
_runtime_functional=self._runtime_functional,
577578
)

0 commit comments

Comments
 (0)