2015-06-07 18:53:14 +03:00
|
|
|
import pytest
|
2015-07-09 13:18:02 +03:00
|
|
|
from spacy.en import English, LOCAL_DATA_DIR
|
|
|
|
import os
|
2015-06-07 18:53:14 +03:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
|
|
def EN():
|
2015-07-09 13:18:02 +03:00
|
|
|
data_dir = os.environ.get('SPACY_DATA', LOCAL_DATA_DIR)
|
|
|
|
return English(data_dir=data_dir)
|
2015-07-23 02:19:03 +03:00
|
|
|
|
|
|
|
|
|
|
|
def pytest_addoption(parser):
|
|
|
|
parser.addoption("--models", action="store_true",
|
|
|
|
help="include tests that require full models")
|
|
|
|
parser.addoption("--vectors", action="store_true",
|
|
|
|
help="include word vectors tests")
|
|
|
|
parser.addoption("--slow", action="store_true",
|
|
|
|
help="include slow tests")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def pytest_runtest_setup(item):
|
|
|
|
for opt in ['models', 'vectors', 'slow']:
|
|
|
|
if opt in item.keywords and not item.config.getoption("--%s" % opt):
|
|
|
|
pytest.skip("need --%s option to run" % opt)
|