Add path fixture for spaCy data path

This commit is contained in:
Ines Montani 2017-01-12 23:38:47 +01:00
parent 0894b8c0ef
commit 514bfa2597

View File

@ -13,8 +13,11 @@ from ..hu import Hungarian
from ..tokens import Doc from ..tokens import Doc
from ..strings import StringStore from ..strings import StringStore
from ..attrs import ORTH, TAG, HEAD, DEP from ..attrs import ORTH, TAG, HEAD, DEP
from ..util import match_best_version, get_data_path
from io import StringIO from io import StringIO
from pathlib import Path
import os
import pytest import pytest
@ -68,6 +71,14 @@ def text_file():
return StringIO() return StringIO()
@pytest.fixture
def path():
if 'SPACY_DATA' in os.environ:
return Path(os.environ['SPACY_DATA'])
else:
return match_best_version('en', None, get_data_path())
# only used for tests that require loading the models # only used for tests that require loading the models
# in all other cases, use specific instances # in all other cases, use specific instances
@pytest.fixture(scope="session") @pytest.fixture(scope="session")