* Allow SPACY_DATA environment variable in website tests

This commit is contained in:
Matthew Honnibal 2015-10-10 17:58:57 +11:00
parent 1cac36bf1c
commit e18fbcb604
2 changed files with 8 additions and 4 deletions

View File

@ -1,11 +1,13 @@
from __future__ import unicode_literals
import pytest
import os
@pytest.fixture(scope='session')
def nlp():
from spacy.en import English
return English()
from spacy.en import English, LOCAL_DATA_DIR
data_dir = os.environ.get('SPACY_DATA', LOCAL_DATA_DIR)
return English(data_dir=data_dir)
@pytest.fixture()

View File

@ -1,6 +1,7 @@
from __future__ import unicode_literals
import pytest
import spacy
import os
@pytest.fixture()
@ -9,8 +10,9 @@ def token(doc):
def test_load_resources_and_process_text():
from spacy.en import English
nlp = English()
from spacy.en import English, LOCAL_DATA_DIR
data_dir = os.environ.get('SPACY_DATA', LOCAL_DATA_DIR)
nlp = English(data_dir=data_dir)
doc = nlp('Hello, world. Here are two sentences.')