]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Fix linter unit tests at package build time
authorLuca Boccassi <luca.boccassi@gmail.com>
Mon, 1 Jun 2026 21:37:29 +0000 (22:37 +0100)
committerMartin Pitt <martin@piware.de>
Tue, 2 Jun 2026 09:57:50 +0000 (11:57 +0200)
Unit tests are broken as they expect a CI environment, but they are also
ran at package build time. Skip gracefully when the git or the
make-man-page.sh scripts are not available.

Follow-up for b0f9525c2c74401fc4280c48233aa9831ced60d5

tests/test_linters.py

index c92224077cd73ada4546b9d928b8f457bfae3530..f1d6464af66ad3a078671499f18fe05ba774e115 100644 (file)
@@ -40,6 +40,7 @@ def test_ruff_check() -> None:
     )
 
 
+@pytest.mark.skipif(skip_if_missing("git"), reason="git not found")
 def test_no_tabs_in_code() -> None:
     result = run(["git", "grep", "-P", r"\t", "*.py"], check=False, cwd=REPO_ROOT)
     assert result.returncode != 0, "Found tabs in Python code"
@@ -86,5 +87,9 @@ def test_shellcheck() -> None:
 
 
 @pytest.mark.skipif(skip_if_missing("pandoc"), reason="pandoc not found")
+@pytest.mark.skipif(
+    SKIP_MISSING_TOOLS and not (REPO_ROOT / "tools/make-man-page.sh").exists(),
+    reason="tools/make-man-page.sh not found",
+)
 def test_man_page_generation() -> None:
     run(["tools/make-man-page.sh"], cwd=REPO_ROOT)