Skip project clone tests if git is not available (#12394)

This commit is contained in:
Adriane Boyd 2023-03-09 16:41:21 +01:00 committed by GitHub
parent 913d74f509
commit f27bce67fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -5,10 +5,18 @@ import srsly
from typer.testing import CliRunner from typer.testing import CliRunner
from spacy.tokens import DocBin, Doc 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 from .util import make_tempdir, normalize_whitespace
def has_git():
try:
get_git_version()
return True
except RuntimeError:
return False
def test_convert_auto(): def test_convert_auto():
with make_tempdir() as d_in, make_tempdir() as d_out: with make_tempdir() as d_in, make_tempdir() as d_out:
for f in ["data1.iob", "data2.iob", "data3.iob"]: for f in ["data1.iob", "data2.iob", "data3.iob"]:
@ -181,6 +189,7 @@ def test_project_run(project_dir):
assert "okokok" in result.stdout assert "okokok" in result.stdout
@pytest.mark.skipif(not has_git(), reason="git not installed")
@pytest.mark.parametrize( @pytest.mark.parametrize(
"options", "options",
[ [