From dbb7aa00518c235fd3734010968482af1aa261eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Fri, 31 Jan 2025 16:27:36 +0100 Subject: [PATCH] test/sbom/spdx: move importorskip to relevant test case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the call to `pytest.importorskip()` function into a specific test case that relies on imported modules. This will make test cases in the same file to be run, even if importing the modules fail. Signed-off-by: Tomáš Hozza --- test/mod/test_util_sbom_spdx.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/mod/test_util_sbom_spdx.py b/test/mod/test_util_sbom_spdx.py index d87d7ab4..55248d13 100644 --- a/test/mod/test_util_sbom_spdx.py +++ b/test/mod/test_util_sbom_spdx.py @@ -18,9 +18,6 @@ from osbuild.util.sbom.spdx2.model import ( from ..test import patch_license_expression -testutil_dnf4 = pytest.importorskip("osbuild.testutil.dnf4") -bom_dnf = pytest.importorskip("osbuild.util.sbom.dnf") - @pytest.mark.parametrize("licensing_available", (True, False)) def test_spdxlicenseexpressionfactory_license_expression_availability(licensing_available): @@ -71,6 +68,9 @@ def test_create_spdx2_document(): @pytest.mark.parametrize("licensing_available", (True, False)) def test_sbom_pkgset_to_spdx2_doc(licensing_available): + testutil_dnf4 = pytest.importorskip("osbuild.testutil.dnf4") + bom_dnf = pytest.importorskip("osbuild.util.sbom.dnf") + dnf_pkgset = testutil_dnf4.depsolve_pkgset([os.path.abspath("./test/data/testrepos/baseos")], ["bash"]) bom_pkgset = bom_dnf.dnf_pkgset_to_sbom_pkgset(dnf_pkgset)