From f27bce67fdfcd5ea7e5fd011273012e8b8c2ed54 Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Thu, 9 Mar 2023 16:41:21 +0100 Subject: [PATCH] Skip project clone tests if git is not available (#12394) --- spacy/tests/test_cli_app.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spacy/tests/test_cli_app.py b/spacy/tests/test_cli_app.py index 8aaadf686..9ba4f0e5c 100644 --- a/spacy/tests/test_cli_app.py +++ b/spacy/tests/test_cli_app.py @@ -5,10 +5,18 @@ import srsly from typer.testing import CliRunner from spacy.tokens import DocBin, Doc -from spacy.cli._util import app +from spacy.cli._util import app, get_git_version from .util import make_tempdir, normalize_whitespace +def has_git(): + try: + get_git_version() + return True + except RuntimeError: + return False + + def test_convert_auto(): with make_tempdir() as d_in, make_tempdir() as d_out: for f in ["data1.iob", "data2.iob", "data3.iob"]: @@ -181,6 +189,7 @@ def test_project_run(project_dir): assert "okokok" in result.stdout +@pytest.mark.skipif(not has_git(), reason="git not installed") @pytest.mark.parametrize( "options", [