Update tests documentation (resolves #1781)

This commit is contained in:
ines 2018-01-03 16:42:26 +01:00
parent ff9fc945ab
commit 95063ba26b
1 changed files with 24 additions and 3 deletions

View File

@ -207,14 +207,26 @@ p
p p
| spaCy comes with an #[+a(gh("spacy", "spacy/tests")) extensive test suite]. | spaCy comes with an #[+a(gh("spacy", "spacy/tests")) extensive test suite].
| First, find out where spaCy is installed: | In order to run the tests, you'll usually want to clone the
| #[+a(gh("spacy")) repository] and #[+a("#source") build spaCy from source].
| This will also install the required development dependencies and test
| utilities defined in the #[code requirements.txt].
p
| Alternatively, you can find out where spaCy is installed and run
| #[code pytest] on that directory. Don't forget to also install the
| test utilities via spaCy's
| #[+a(gh("spacy", "requirements.txt")) #[code requirements.txt]]:
+code(false, "bash"). +code(false, "bash").
python -c "import os; import spacy; print(os.path.dirname(spacy.__file__))" python -c "import os; import spacy; print(os.path.dirname(spacy.__file__))"
pip install -r path/to/requirements.txt
python -m pytest <spacy-directory>
p p
| Then run #[code pytest] on that directory. The flags #[code --slow] and | Calling #[code pytest] on the spaCy directory will run only the basic
| #[code --model] are optional and enable additional tests. | tests. The flags #[code --slow] and #[code --model] are optional and
| enable additional tests that take longer or use specific models.
+code(false, "bash"). +code(false, "bash").
# make sure you are using recent pytest version # make sure you are using recent pytest version
@ -224,3 +236,12 @@ p
python -m pytest <spacy-directory> --slow # basic and slow tests python -m pytest <spacy-directory> --slow # basic and slow tests
python -m pytest <spacy-directory> --models --all # basic and all model tests python -m pytest <spacy-directory> --models --all # basic and all model tests
python -m pytest <spacy-directory> --models --en # basic and English model tests python -m pytest <spacy-directory> --models --en # basic and English model tests
+infobox("Note on model tests", "⚠️")
| The test suite specifies a #[+a(gh("spacy", "tests/conftest.py")) list of models]
| to run the tests on. If a model is not installed, the tests will be
| skipped. If all models are installed, the respective tests will run once
| for each model. The easiest way to find out which models and model
| versions are available in your current environment is to run
| #[+a("/api/cli#validate") #[code python -m spacy validate]]. This will
| also show whether an installed model is out of date, and how to update it.