From ffc4a06085c4592d3cd5d19e4b30b2523a41f4de Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 6 Jan 2025 18:44:39 +0100 Subject: [PATCH] sources: skip librepo test if no librepo can be imported The librepo test has a similar issue as the dnf tests, we need to use the system packages, c.f. https://github.com/osbuild/containers/pull/79 But ensure it is run as part of the unittests_as_user_smoke. --- .github/workflows/test.yml | 2 +- sources/test/test_librepo.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5221e08e8..0b0f8195f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -86,7 +86,7 @@ jobs: # The test_host.py:test_signals_on_separate_fd runs itself but that # run will happen without the tox env so a pip/tox installed pytest # will not be found, install the pytest package as a workaround - - run: sudo apt install -y tox python3-pytest + - run: sudo apt install -y tox python3-pytest python3-librepo - name: "Run as user on default runer" # Run with -n 16 as depsolve tests tend to be slow but fast when # parallized, the runtime is around 1-2min with this setup. diff --git a/sources/test/test_librepo.py b/sources/test/test_librepo.py index b013d8eef..aaabfba1c 100644 --- a/sources/test/test_librepo.py +++ b/sources/test/test_librepo.py @@ -1,7 +1,11 @@ #!/usr/bin/python3 from unittest.mock import patch -import librepo +try: + import librepo +except ImportError: + import pytest + pytest.skip("need librepo to run this test") import pytest from osbuild import testutil