From: Daan De Meyer Date: Mon, 7 Oct 2024 08:39:38 +0000 (+0200) Subject: Make tools tree available in tests X-Git-Tag: v25~228^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3109%2Fhead;p=thirdparty%2Fmkosi.git Make tools tree available in tests For use with find_binary() to check if binaries exist in the tools tree. --- diff --git a/tests/__init__.py b/tests/__init__.py index 7a7ab89c5..419138b00 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -25,6 +25,7 @@ class ImageConfig: distribution: Distribution release: str debug_shell: bool + tools: Optional[Path] class Image: @@ -64,6 +65,7 @@ class Image: return run( [ "python3", "-m", "mkosi", + *(["--tools-tree", os.fspath(self.config.tools)] if self.config.tools else []), "--debug", *options, verb, diff --git a/tests/conftest.py b/tests/conftest.py index 86e5a5ba0..86ae99a20 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,6 @@ # SPDX-License-Identifier: LGPL-2.1-or-later from collections.abc import Iterator +from pathlib import Path from typing import Any, cast import pytest @@ -48,6 +49,7 @@ def config(request: Any) -> ImageConfig: distribution=distribution, release=release, debug_shell=request.config.getoption("--debug-shell"), + tools=p if (p := Path("mkosi.tools")).exists() else None, )