From ce3e3063764a1b9dc002765450659b8adba1b1d7 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sat, 10 Oct 2015 17:58:57 +1100 Subject: [PATCH] * Allow SPACY_DATA environment variable in website tests --- tests/website/conftest.py | 6 ++++-- tests/website/test_home.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/website/conftest.py b/tests/website/conftest.py index ade1bae2a..35c38d845 100644 --- a/tests/website/conftest.py +++ b/tests/website/conftest.py @@ -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() diff --git a/tests/website/test_home.py b/tests/website/test_home.py index 4da61becf..3f7f7ea4c 100644 --- a/tests/website/test_home.py +++ b/tests/website/test_home.py @@ -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.')