From 20c2db08b7372af9d4f78cf4fb59a1c94bfd0fd6 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Thu, 23 Jul 2015 01:19:03 +0200 Subject: [PATCH] * Add flags to pytest to tests requiring models, vectors or slow functions to be toggled. --- tests/conftest.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 43a275cd6..6aee2c31e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,3 +7,19 @@ import os def EN(): data_dir = os.environ.get('SPACY_DATA', LOCAL_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)