From ad135a8217563ee0e22efde220961856c780a716 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 7 Oct 2024 10:39:38 +0200 Subject: [PATCH] Make tools tree available in tests For use with find_binary() to check if binaries exist in the tools tree. --- tests/__init__.py | 2 ++ tests/conftest.py | 2 ++ 2 files changed, 4 insertions(+) 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, ) -- 2.47.2