Skip to content

Commit

Permalink
sources: skip ostree tests if no ostree binary if found
Browse files Browse the repository at this point in the history
This commit skips the ostree tests if no ostree binary is available.
  • Loading branch information
mvo5 authored and achilleas-k committed Nov 28, 2024
1 parent 2375021 commit 21c8863
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sources/test/test_ostree_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@
import pathlib
import tempfile

import pytest

from osbuild.testutil import has_executable
from osbuild.testutil.net import http_serve_directory, https_serve_directory
from osbuild.util import ostree

SOURCES_NAME = "org.osbuild.ostree"


@pytest.mark.skipif(not has_executable("ostree"), reason="need ostree")
def test_ostree_source_not_exists(tmp_path, sources_service):
checksum = "sha256:1111111111111111111111111111111111111111111111111111111111111111"
sources_service.setup({"cache": tmp_path, "options": {}})
assert not sources_service.exists(checksum, None)


@pytest.mark.skipif(not has_executable("ostree"), reason="need ostree")
def test_ostree_source_exists(tmp_path, sources_service):
sources_service.setup({"cache": tmp_path, "options": {}})
root = tmp_path / "org.osbuild.ostree" / "repo"
Expand All @@ -41,6 +46,7 @@ def make_repo(root):
return ostree.cli("commit", f"--repo={root}", "--orphan", empty_tmpdir).stdout.rstrip()


@pytest.mark.skipif(not has_executable("ostree"), reason="need ostree")
def test_ostree_pull_plain(tmp_path, sources_service):
fake_httpd_root = tmp_path / "fake-httpd-root"
fake_httpd_root.mkdir(exist_ok=True)
Expand All @@ -53,6 +59,7 @@ def test_ostree_pull_plain(tmp_path, sources_service):
assert sources_service.exists("sha256:" + fake_commit, None)


@pytest.mark.skipif(not has_executable("ostree"), reason="need ostree")
def test_ostree_pull_plain_mtls(tmp_path, sources_service, monkeypatch):
fake_httpd_root = tmp_path / "fake-httpd-root"
fake_httpd_root.mkdir(exist_ok=True)
Expand Down

0 comments on commit 21c8863

Please sign in to comment.