* Add flags to pytest to tests requiring models, vectors or slow functions to be toggled.

This commit is contained in:
Matthew Honnibal 2015-07-23 01:19:03 +02:00
parent a7c4d72e83
commit 20c2db08b7
1 changed files with 16 additions and 0 deletions

View File

@ -7,3 +7,19 @@ import os
def EN(): def EN():
data_dir = os.environ.get('SPACY_DATA', LOCAL_DATA_DIR) data_dir = os.environ.get('SPACY_DATA', LOCAL_DATA_DIR)
return English(data_dir=data_dir) return English(data_dir=data_dir)
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)