mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 18:06:29 +03:00
Add path fixture for spaCy data path
This commit is contained in:
parent
0894b8c0ef
commit
514bfa2597
|
@ -13,8 +13,11 @@ from ..hu import Hungarian
|
|||
from ..tokens import Doc
|
||||
from ..strings import StringStore
|
||||
from ..attrs import ORTH, TAG, HEAD, DEP
|
||||
from ..util import match_best_version, get_data_path
|
||||
|
||||
from io import StringIO
|
||||
from pathlib import Path
|
||||
import os
|
||||
import pytest
|
||||
|
||||
|
||||
|
@ -68,6 +71,14 @@ def text_file():
|
|||
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
|
||||
# in all other cases, use specific instances
|
||||
@pytest.fixture(scope="session")
|
||||
|
|
Loading…
Reference in New Issue
Block a user