From d348c92ff2d5d30422255a5e7bfb446f6ed7b7e5 Mon Sep 17 00:00:00 2001 From: Arjan Molenaar Date: Thu, 11 Nov 2021 15:35:32 +0100 Subject: [PATCH] Run git handler test only if git-lfs is installed The git handler requires git-lfs. --- tests/test_model_loading.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tests/test_model_loading.py b/tests/test_model_loading.py index fe7741205..5882c750c 100644 --- a/tests/test_model_loading.py +++ b/tests/test_model_loading.py @@ -14,6 +14,7 @@ from __future__ import annotations import pathlib +import subprocess from importlib import metadata import pytest @@ -23,6 +24,13 @@ from . import TEST_MODEL, TEST_ROOT +def has_git_lfs(): + proc = subprocess.run( + ["git", "lfs"], + ) + return proc.returncode == 0 + + @pytest.mark.parametrize( "path", [ @@ -34,15 +42,12 @@ def test_model_loading_via_LocalFileHandler(path: str | pathlib.Path): capellambse.MelodyModel(path) -@pytest.mark.parametrize( - "path", - [ - pytest.param( - "git+" + pathlib.Path.cwd().as_uri(), id="From local repo" - ), - ], +@pytest.mark.skipif( + not has_git_lfs(), + reason="This test requires git-lfs to be present on the system", ) -def test_model_loading_via_GitFileHandler(path: str): +def test_model_loading_via_GitFileHandler(): + path = "git+" + pathlib.Path.cwd().as_uri() capellambse.MelodyModel( path, entrypoint="tests/data/melodymodel/5_0/MelodyModelTest.aird" )