diff --git a/.travis.yml b/.travis.yml index 14d829fd2..957112e92 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ install: script: - "cat /proc/cpuinfo | grep flags | head -n 1" - "pip install pytest pytest-timeout" - - "python -m pytest tests --tb=native spacy" + - "python -m pytest --tb=native spacy" branches: except: - spacy.io diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7ddf61658..8b02b7055 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -175,12 +175,12 @@ The description text can be very short – we don't want to make this too bureaucratic. Next, create a test file named `test_issue[ISSUE NUMBER].py` in the -[`tests/regression`](tests/regression) folder. Test for the bug +[`spacy/tests/regression`](spacy/tests/regression) folder. Test for the bug you're fixing, and make sure the test fails. Next, add and commit your test file referencing the issue number in the commit message. Finally, fix the bug, make sure your test passes and reference the issue in your commit message. -📖 **For more information on how to add tests, check out the [tests README](tests/README.md).** +📖 **For more information on how to add tests, check out the [tests README](spacy/tests/README.md).** ## Code conventions @@ -425,7 +425,7 @@ spaCy uses the [pytest](http://doc.pytest.org/) framework for testing. For more info on this, see the [pytest documentation](http://docs.pytest.org/en/latest/contents.html). Tests for spaCy modules and classes live in their own directories of the same name. For example, tests for the `Tokenizer` can be found in -[`tests/tokenizer`](tests/tokenizer). To be interpreted and run, +[`/spacy/tests/tokenizer`](spacy/tests/tokenizer). To be interpreted and run, all test files and test functions need to be prefixed with `test_`. When adding tests, make sure to use descriptive names, keep the code short and @@ -440,7 +440,7 @@ you're not actually testing the model performance. If all you need is a `Doc` object with annotations like heads, POS tags or the dependency parse, you can use the `get_doc()` utility function to construct it manually. -📖 **For more guidelines and information on how to add tests, check out the [tests README](tests/README.md).** +📖 **For more guidelines and information on how to add tests, check out the [tests README](spacy/tests/README.md).** ## Updating the website diff --git a/README.md b/README.md index a0d3585ac..6bdbc7e46 100644 --- a/README.md +++ b/README.md @@ -270,7 +270,7 @@ VS 2010 (Python 3.4) and VS 2015 (Python 3.5). ## Run tests -spaCy comes with an [extensive test suite](tests). In order to run the +spaCy comes with an [extensive test suite](spacy/tests). In order to run the tests, you'll usually want to clone the repository and build spaCy from source. This will also install the required development dependencies and test utilities defined in the `requirements.txt`. diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5e1e78249..de5864548 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -98,5 +98,5 @@ jobs: pip install dist/$SDIST displayName: 'Install from sdist' - - script: python -m pytest tests + - script: python -m pytest spacy/tests displayName: 'Run tests' diff --git a/fabfile.py b/fabfile.py index 5431dcec8..2ab74ce24 100644 --- a/fabfile.py +++ b/fabfile.py @@ -3,152 +3,120 @@ from __future__ import unicode_literals, print_function import contextlib from pathlib import Path -from fabric.api import local, lcd, env +from fabric.api import local, lcd, env, settings, prefix from os import path, environ import shutil import sys PWD = path.dirname(__file__) -ENV = environ["VENV_DIR"] if "VENV_DIR" in environ else ".env" +ENV = environ['VENV_DIR'] if 'VENV_DIR' in environ else '.env' VENV_DIR = Path(PWD) / ENV @contextlib.contextmanager -def virtualenv(name, create=False, python="/usr/bin/python3.6"): +def virtualenv(name, create=False, python='/usr/bin/python3.6'): python = Path(python).resolve() env_path = VENV_DIR if create: if env_path.exists(): shutil.rmtree(str(env_path)) - local("{python} -m venv {env_path}".format(python=python, env_path=VENV_DIR)) - + local('{python} -m venv {env_path}'.format(python=python, env_path=VENV_DIR)) def wrapped_local(cmd, env_vars=[], capture=False, direct=False): - return local( - "source {}/bin/activate && {}".format(env_path, cmd), - shell="/bin/bash", - capture=False, - ) - + return local('source {}/bin/activate && {}'.format(env_path, cmd), + shell='/bin/bash', capture=False) yield wrapped_local -def env(lang="python3.6"): +def env(lang='python3.6'): if VENV_DIR.exists(): - local("rm -rf {env}".format(env=VENV_DIR)) - if lang.startswith("python3"): - local("{lang} -m venv {env}".format(lang=lang, env=VENV_DIR)) + local('rm -rf {env}'.format(env=VENV_DIR)) + if lang.startswith('python3'): + local('{lang} -m venv {env}'.format(lang=lang, env=VENV_DIR)) else: - local("{lang} -m pip install virtualenv --no-cache-dir".format(lang=lang)) - local( - "{lang} -m virtualenv {env} --no-cache-dir".format(lang=lang, env=VENV_DIR) - ) + local('{lang} -m pip install virtualenv --no-cache-dir'.format(lang=lang)) + local('{lang} -m virtualenv {env} --no-cache-dir'.format(lang=lang, env=VENV_DIR)) with virtualenv(VENV_DIR) as venv_local: - print(venv_local("python --version", capture=True)) - venv_local("pip install --upgrade setuptools --no-cache-dir") - venv_local("pip install pytest --no-cache-dir") - venv_local("pip install wheel --no-cache-dir") - venv_local("pip install -r requirements.txt --no-cache-dir") - venv_local("pip install pex --no-cache-dir") + print(venv_local('python --version', capture=True)) + venv_local('pip install --upgrade setuptools --no-cache-dir') + venv_local('pip install pytest --no-cache-dir') + venv_local('pip install wheel --no-cache-dir') + venv_local('pip install -r requirements.txt --no-cache-dir') + venv_local('pip install pex --no-cache-dir') + def install(): with virtualenv(VENV_DIR) as venv_local: - venv_local("pip install dist/*.tar.gz") + venv_local('pip install dist/*.tar.gz') def make(): with lcd(path.dirname(__file__)): - local( - "export PYTHONPATH=`pwd` && source .env/bin/activate && python setup.py build_ext --inplace", - shell="/bin/bash", - ) - + local('export PYTHONPATH=`pwd` && source .env/bin/activate && python setup.py build_ext --inplace', + shell='/bin/bash') def sdist(): with virtualenv(VENV_DIR) as venv_local: with lcd(path.dirname(__file__)): - local("python -m pip install -U setuptools srsly") - local("python setup.py sdist") - + local('python -m pip install -U setuptools srsly') + local('python setup.py sdist') def wheel(): with virtualenv(VENV_DIR) as venv_local: with lcd(path.dirname(__file__)): - venv_local("python setup.py bdist_wheel") - + venv_local('python setup.py bdist_wheel') def pex(): with virtualenv(VENV_DIR) as venv_local: with lcd(path.dirname(__file__)): - sha = local("git rev-parse --short HEAD", capture=True) - venv_local( - "pex dist/*.whl -e spacy -o dist/spacy-%s.pex" % sha, direct=True - ) + sha = local('git rev-parse --short HEAD', capture=True) + venv_local('pex dist/*.whl -e spacy -o dist/spacy-%s.pex' % sha, + direct=True) def clean(): with lcd(path.dirname(__file__)): - local("rm -f dist/*.whl") - local("rm -f dist/*.pex") + local('rm -f dist/*.whl') + local('rm -f dist/*.pex') with virtualenv(VENV_DIR) as venv_local: - venv_local("python setup.py clean --all") + venv_local('python setup.py clean --all') def test(): with virtualenv(VENV_DIR) as venv_local: with lcd(path.dirname(__file__)): - venv_local("pytest -x tests") - + venv_local('pytest -x spacy/tests') def train(): - args = environ.get("SPACY_TRAIN_ARGS", "") + args = environ.get('SPACY_TRAIN_ARGS', '') with virtualenv(VENV_DIR) as venv_local: - venv_local("spacy train {args}".format(args=args)) + venv_local('spacy train {args}'.format(args=args)) -def conll17(treebank_dir, experiment_dir, vectors_dir, config, corpus=""): - is_not_clean = local("git status --porcelain", capture=True) +def conll17(treebank_dir, experiment_dir, vectors_dir, config, corpus=''): + is_not_clean = local('git status --porcelain', capture=True) if is_not_clean: print("Repository is not clean") print(is_not_clean) sys.exit(1) - git_sha = local("git rev-parse --short HEAD", capture=True) - config_checksum = local("sha256sum {config}".format(config=config), capture=True) - experiment_dir = Path(experiment_dir) / "{}--{}".format( - config_checksum[:6], git_sha - ) + git_sha = local('git rev-parse --short HEAD', capture=True) + config_checksum = local('sha256sum {config}'.format(config=config), capture=True) + experiment_dir = Path(experiment_dir) / '{}--{}'.format(config_checksum[:6], git_sha) if not experiment_dir.exists(): experiment_dir.mkdir() - test_data_dir = Path(treebank_dir) / "ud-test-v2.0-conll2017" + test_data_dir = Path(treebank_dir) / 'ud-test-v2.0-conll2017' assert test_data_dir.exists() assert test_data_dir.is_dir() if corpus: corpora = [corpus] else: - corpora = ["UD_English", "UD_Chinese", "UD_Japanese", "UD_Vietnamese"] + corpora = ['UD_English', 'UD_Chinese', 'UD_Japanese', 'UD_Vietnamese'] - local( - "cp {config} {experiment_dir}/config.json".format( - config=config, experiment_dir=experiment_dir - ) - ) + local('cp {config} {experiment_dir}/config.json'.format(config=config, experiment_dir=experiment_dir)) with virtualenv(VENV_DIR) as venv_local: for corpus in corpora: - venv_local( - "spacy ud-train {treebank_dir} {experiment_dir} {config} {corpus} -v {vectors_dir}".format( - treebank_dir=treebank_dir, - experiment_dir=experiment_dir, - config=config, - corpus=corpus, - vectors_dir=vectors_dir, - ) - ) - venv_local( - "spacy ud-run-test {test_data_dir} {experiment_dir} {corpus}".format( - test_data_dir=test_data_dir, - experiment_dir=experiment_dir, - config=config, - corpus=corpus, - ) - ) + venv_local('spacy ud-train {treebank_dir} {experiment_dir} {config} {corpus} -v {vectors_dir}'.format( + treebank_dir=treebank_dir, experiment_dir=experiment_dir, config=config, corpus=corpus, vectors_dir=vectors_dir)) + venv_local('spacy ud-run-test {test_data_dir} {experiment_dir} {corpus}'.format( + test_data_dir=test_data_dir, experiment_dir=experiment_dir, config=config, corpus=corpus)) diff --git a/tests/README.md b/spacy/tests/README.md similarity index 52% rename from tests/README.md rename to spacy/tests/README.md index 1c1beac81..7aa7f6166 100644 --- a/tests/README.md +++ b/spacy/tests/README.md @@ -17,6 +17,7 @@ Tests for spaCy modules and classes live in their own directories of the same na 5. [Helpers and utilities](#helpers-and-utilities) 6. [Contributing to the tests](#contributing-to-the-tests) + ## Running the tests To show print statements, run the tests with `py.test -s`. To abort after the @@ -31,25 +32,26 @@ You can also run tests in a specific file or directory, or even only one specific test: ```bash -py.test tests/tokenizer # run all tests in directory -py.test tests/tokenizer/test_exceptions.py # run all tests in file -py.test tests/tokenizer/test_exceptions.py::test_tokenizer_handles_emoji # run specific test +py.test spacy/tests/tokenizer # run all tests in directory +py.test spacy/tests/tokenizer/test_exceptions.py # run all tests in file +py.test spacy/tests/tokenizer/test_exceptions.py::test_tokenizer_handles_emoji # run specific test ``` ## Dos and don'ts To keep the behaviour of the tests consistent and predictable, we try to follow a few basic conventions: -- **Test names** should follow a pattern of `test_[module]_[tested behaviour]`. For example: `test_tokenizer_keeps_email` or `test_spans_override_sentiment`. -- If you're testing for a bug reported in a specific issue, always create a **regression test**. Regression tests should be named `test_issue[ISSUE NUMBER]` and live in the [`regression`](regression) directory. -- Only use `@pytest.mark.xfail` for tests that **should pass, but currently fail**. To test for desired negative behaviour, use `assert not` in your test. -- Very **extensive tests** that take a long time to run should be marked with `@pytest.mark.slow`. If your slow test is testing important behaviour, consider adding an additional simpler version. -- If tests require **loading the models**, they should be added to the [`spacy-models`](https://github.com/explosion/spacy-models) tests. -- Before requiring the models, always make sure there is no other way to test the particular behaviour. In a lot of cases, it's sufficient to simply create a `Doc` object manually. See the section on [helpers and utility functions](#helpers-and-utilities) for more info on this. -- **Avoid unnecessary imports.** There should never be a need to explicitly import spaCy at the top of a file, and many components are available as [fixtures](#fixtures). You should also avoid wildcard imports (`from module import *`). -- If you're importing from spaCy, **always use absolute imports**. For example: `from spacy.language import Language`. -- Don't forget the **unicode declarations** at the top of each file. This way, unicode strings won't have to be prefixed with `u`. -- Try to keep the tests **readable and concise**. Use clear and descriptive variable names (`doc`, `tokens` and `text` are great), keep it short and only test for one behaviour at a time. +* **Test names** should follow a pattern of `test_[module]_[tested behaviour]`. For example: `test_tokenizer_keeps_email` or `test_spans_override_sentiment`. +* If you're testing for a bug reported in a specific issue, always create a **regression test**. Regression tests should be named `test_issue[ISSUE NUMBER]` and live in the [`regression`](regression) directory. +* Only use `@pytest.mark.xfail` for tests that **should pass, but currently fail**. To test for desired negative behaviour, use `assert not` in your test. +* Very **extensive tests** that take a long time to run should be marked with `@pytest.mark.slow`. If your slow test is testing important behaviour, consider adding an additional simpler version. +* If tests require **loading the models**, they should be added to the [`spacy-models`](https://github.com/explosion/spacy-models) tests. +* Before requiring the models, always make sure there is no other way to test the particular behaviour. In a lot of cases, it's sufficient to simply create a `Doc` object manually. See the section on [helpers and utility functions](#helpers-and-utilities) for more info on this. +* **Avoid unnecessary imports.** There should never be a need to explicitly import spaCy at the top of a file, and many components are available as [fixtures](#fixtures). You should also avoid wildcard imports (`from module import *`). +* If you're importing from spaCy, **always use absolute imports**. For example: `from spacy.language import Language`. +* Don't forget the **unicode declarations** at the top of each file. This way, unicode strings won't have to be prefixed with `u`. +* Try to keep the tests **readable and concise**. Use clear and descriptive variable names (`doc`, `tokens` and `text` are great), keep it short and only test for one behaviour at a time. + ## Parameters @@ -62,7 +64,7 @@ def test_tokenizer_keep_urls(tokenizer, text): assert len(tokens) == 1 ``` -This will run the test once for each `text` value. Even if you're only testing one example, it's usually best to specify it as a parameter. This will later make it easier for others to quickly add additional test cases without having to modify the test. +This will run the test once for each `text` value. Even if you're only testing one example, it's usually best to specify it as a parameter. This will later make it easier for others to quickly add additional test cases without having to modify the test. You can also specify parameters as tuples to test with multiple values per test: @@ -79,17 +81,18 @@ To test for combinations of parameters, you can add several `parametrize` marker This will run the test with all combinations of the two parameters `text` and `punct`. **Use this feature sparingly**, though, as it can easily cause unneccessary or undesired test bloat. + ## Fixtures Fixtures to create instances of spaCy objects and other components should only be defined once in the global [`conftest.py`](conftest.py). We avoid having per-directory conftest files, as this can easily lead to confusion. These are the main fixtures that are currently available: -| Fixture | Description | -| ----------------------------------- | ---------------------------------------------------------------------------- | -| `tokenizer` | Basic, language-independent tokenizer. Identical to the `xx` language class. | -| `en_tokenizer`, `de_tokenizer`, ... | Creates an English, German etc. tokenizer. | -| `en_vocab` | Creates an instance of the English `Vocab`. | +| Fixture | Description | +| --- | --- | +| `tokenizer` | Basic, language-independent tokenizer. Identical to the `xx` language class. | +| `en_tokenizer`, `de_tokenizer`, ... | Creates an English, German etc. tokenizer. | +| `en_vocab` | Creates an instance of the English `Vocab`. | The fixtures can be used in all tests by simply setting them as an argument, like this: @@ -104,6 +107,7 @@ If all tests in a file require a specific configuration, or use the same complex Our new test setup comes with a few handy utility functions that can be imported from [`util.py`](util.py). + ### Constructing a `Doc` object manually with `get_doc()` Loading the models is expensive and not necessary if you're not actually testing the model performance. If all you need ia a `Doc` object with annotations like heads, POS tags or the dependency parse, you can use `get_doc()` to construct it manually. @@ -125,15 +129,15 @@ def test_doc_token_api_strings(en_tokenizer): You can construct a `Doc` with the following arguments: -| Argument | Description | -| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `vocab` | `Vocab` instance to use. If you're tokenizing before creating a `Doc`, make sure to use the tokenizer's vocab. Otherwise, you can also use the `en_vocab` fixture. **(required)** | -| `words` | List of words, for example `[t.text for t in tokens]`. **(required)** | -| `heads` | List of heads as integers. | -| `pos` | List of POS tags as text values. | -| `tag` | List of tag names as text values. | -| `dep` | List of dependencies as text values. | -| `ents` | List of entity tuples with `start`, `end`, `label` (for example `(0, 2, 'PERSON')`). The `label` will be looked up in `vocab.strings[label]`. | +| Argument | Description | +| --- | --- | +| `vocab` | `Vocab` instance to use. If you're tokenizing before creating a `Doc`, make sure to use the tokenizer's vocab. Otherwise, you can also use the `en_vocab` fixture. **(required)** | +| `words` | List of words, for example `[t.text for t in tokens]`. **(required)** | +| `heads` | List of heads as integers. | +| `pos` | List of POS tags as text values. | +| `tag` | List of tag names as text values. | +| `dep` | List of dependencies as text values. | +| `ents` | List of entity tuples with `start`, `end`, `label` (for example `(0, 2, 'PERSON')`). The `label` will be looked up in `vocab.strings[label]`. | Here's how to quickly get these values from within spaCy: @@ -150,12 +154,12 @@ print([(ent.start, ent.end, ent.label_) for ent in doc.ents]) ### Other utilities -| Name | Description | -| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | -| `apply_transition_sequence(parser, doc, sequence)` | Perform a series of pre-specified transitions, to put the parser in a desired state. | -| `add_vecs_to_vocab(vocab, vectors)` | Add list of vector tuples (`[("text", [1, 2, 3])]`) to given vocab. All vectors need to have the same length. | -| `get_cosine(vec1, vec2)` | Get cosine for two given vectors. | -| `assert_docs_equal(doc1, doc2)` | Compare two `Doc` objects and `assert` that they're equal. Tests for tokens, tags, dependencies and entities. | +| Name | Description | +| --- | --- | +| `apply_transition_sequence(parser, doc, sequence)` | Perform a series of pre-specified transitions, to put the parser in a desired state. | +| `add_vecs_to_vocab(vocab, vectors)` | Add list of vector tuples (`[("text", [1, 2, 3])]`) to given vocab. All vectors need to have the same length. | +| `get_cosine(vec1, vec2)` | Get cosine for two given vectors. | +| `assert_docs_equal(doc1, doc2)` | Compare two `Doc` objects and `assert` that they're equal. Tests for tokens, tags, dependencies and entities. | ## Contributing to the tests diff --git a/tests/__init__.py b/spacy/tests/__init__.py similarity index 100% rename from tests/__init__.py rename to spacy/tests/__init__.py diff --git a/tests/conftest.py b/spacy/tests/conftest.py similarity index 100% rename from tests/conftest.py rename to spacy/tests/conftest.py diff --git a/tests/doc/__init__.py b/spacy/tests/doc/__init__.py similarity index 100% rename from tests/doc/__init__.py rename to spacy/tests/doc/__init__.py diff --git a/tests/doc/test_add_entities.py b/spacy/tests/doc/test_add_entities.py similarity index 94% rename from tests/doc/test_add_entities.py rename to spacy/tests/doc/test_add_entities.py index 6c69e699a..374c3ddd8 100644 --- a/tests/doc/test_add_entities.py +++ b/spacy/tests/doc/test_add_entities.py @@ -1,11 +1,11 @@ # coding: utf-8 from __future__ import unicode_literals -from spacy.pipeline import EntityRecognizer -from spacy.tokens import Span -import pytest - +from ...pipeline import EntityRecognizer from ..util import get_doc +from ...tokens import Span + +import pytest def test_doc_add_entities_set_ents_iob(en_vocab): diff --git a/tests/doc/test_array.py b/spacy/tests/doc/test_array.py similarity index 100% rename from tests/doc/test_array.py rename to spacy/tests/doc/test_array.py diff --git a/tests/doc/test_creation.py b/spacy/tests/doc/test_creation.py similarity index 100% rename from tests/doc/test_creation.py rename to spacy/tests/doc/test_creation.py diff --git a/tests/doc/test_doc_api.py b/spacy/tests/doc/test_doc_api.py similarity index 100% rename from tests/doc/test_doc_api.py rename to spacy/tests/doc/test_doc_api.py diff --git a/tests/doc/test_morphanalysis.py b/spacy/tests/doc/test_morphanalysis.py similarity index 100% rename from tests/doc/test_morphanalysis.py rename to spacy/tests/doc/test_morphanalysis.py diff --git a/tests/doc/test_pickle_doc.py b/spacy/tests/doc/test_pickle_doc.py similarity index 100% rename from tests/doc/test_pickle_doc.py rename to spacy/tests/doc/test_pickle_doc.py diff --git a/tests/doc/test_retokenize_merge.py b/spacy/tests/doc/test_retokenize_merge.py similarity index 100% rename from tests/doc/test_retokenize_merge.py rename to spacy/tests/doc/test_retokenize_merge.py diff --git a/tests/doc/test_retokenize_split.py b/spacy/tests/doc/test_retokenize_split.py similarity index 100% rename from tests/doc/test_retokenize_split.py rename to spacy/tests/doc/test_retokenize_split.py diff --git a/tests/doc/test_span.py b/spacy/tests/doc/test_span.py similarity index 100% rename from tests/doc/test_span.py rename to spacy/tests/doc/test_span.py diff --git a/tests/doc/test_to_json.py b/spacy/tests/doc/test_to_json.py similarity index 100% rename from tests/doc/test_to_json.py rename to spacy/tests/doc/test_to_json.py diff --git a/tests/doc/test_token_api.py b/spacy/tests/doc/test_token_api.py similarity index 100% rename from tests/doc/test_token_api.py rename to spacy/tests/doc/test_token_api.py diff --git a/tests/doc/test_underscore.py b/spacy/tests/doc/test_underscore.py similarity index 100% rename from tests/doc/test_underscore.py rename to spacy/tests/doc/test_underscore.py diff --git a/tests/lang/__init__.py b/spacy/tests/lang/__init__.py similarity index 100% rename from tests/lang/__init__.py rename to spacy/tests/lang/__init__.py diff --git a/tests/lang/ar/__init__.py b/spacy/tests/lang/ar/__init__.py similarity index 100% rename from tests/lang/ar/__init__.py rename to spacy/tests/lang/ar/__init__.py diff --git a/tests/lang/ar/test_exceptions.py b/spacy/tests/lang/ar/test_exceptions.py similarity index 100% rename from tests/lang/ar/test_exceptions.py rename to spacy/tests/lang/ar/test_exceptions.py diff --git a/tests/lang/ar/test_text.py b/spacy/tests/lang/ar/test_text.py similarity index 100% rename from tests/lang/ar/test_text.py rename to spacy/tests/lang/ar/test_text.py diff --git a/tests/lang/bn/__init__.py b/spacy/tests/lang/bn/__init__.py similarity index 100% rename from tests/lang/bn/__init__.py rename to spacy/tests/lang/bn/__init__.py diff --git a/tests/lang/bn/test_tokenizer.py b/spacy/tests/lang/bn/test_tokenizer.py similarity index 100% rename from tests/lang/bn/test_tokenizer.py rename to spacy/tests/lang/bn/test_tokenizer.py diff --git a/tests/lang/ca/__init__.py b/spacy/tests/lang/ca/__init__.py similarity index 100% rename from tests/lang/ca/__init__.py rename to spacy/tests/lang/ca/__init__.py diff --git a/tests/lang/ca/test_exception.py b/spacy/tests/lang/ca/test_exception.py similarity index 100% rename from tests/lang/ca/test_exception.py rename to spacy/tests/lang/ca/test_exception.py diff --git a/tests/lang/ca/test_prefix_suffix_infix.py b/spacy/tests/lang/ca/test_prefix_suffix_infix.py similarity index 100% rename from tests/lang/ca/test_prefix_suffix_infix.py rename to spacy/tests/lang/ca/test_prefix_suffix_infix.py diff --git a/tests/lang/ca/test_text.py b/spacy/tests/lang/ca/test_text.py similarity index 100% rename from tests/lang/ca/test_text.py rename to spacy/tests/lang/ca/test_text.py diff --git a/tests/lang/da/__init__.py b/spacy/tests/lang/da/__init__.py similarity index 100% rename from tests/lang/da/__init__.py rename to spacy/tests/lang/da/__init__.py diff --git a/tests/lang/da/test_exceptions.py b/spacy/tests/lang/da/test_exceptions.py similarity index 100% rename from tests/lang/da/test_exceptions.py rename to spacy/tests/lang/da/test_exceptions.py diff --git a/tests/lang/da/test_lemma.py b/spacy/tests/lang/da/test_lemma.py similarity index 100% rename from tests/lang/da/test_lemma.py rename to spacy/tests/lang/da/test_lemma.py diff --git a/tests/lang/da/test_prefix_suffix_infix.py b/spacy/tests/lang/da/test_prefix_suffix_infix.py similarity index 100% rename from tests/lang/da/test_prefix_suffix_infix.py rename to spacy/tests/lang/da/test_prefix_suffix_infix.py diff --git a/tests/lang/da/test_text.py b/spacy/tests/lang/da/test_text.py similarity index 100% rename from tests/lang/da/test_text.py rename to spacy/tests/lang/da/test_text.py diff --git a/tests/lang/de/__init__.py b/spacy/tests/lang/de/__init__.py similarity index 100% rename from tests/lang/de/__init__.py rename to spacy/tests/lang/de/__init__.py diff --git a/tests/lang/de/test_exceptions.py b/spacy/tests/lang/de/test_exceptions.py similarity index 100% rename from tests/lang/de/test_exceptions.py rename to spacy/tests/lang/de/test_exceptions.py diff --git a/tests/lang/de/test_lemma.py b/spacy/tests/lang/de/test_lemma.py similarity index 100% rename from tests/lang/de/test_lemma.py rename to spacy/tests/lang/de/test_lemma.py diff --git a/tests/lang/de/test_parser.py b/spacy/tests/lang/de/test_parser.py similarity index 100% rename from tests/lang/de/test_parser.py rename to spacy/tests/lang/de/test_parser.py diff --git a/tests/lang/de/test_prefix_suffix_infix.py b/spacy/tests/lang/de/test_prefix_suffix_infix.py similarity index 100% rename from tests/lang/de/test_prefix_suffix_infix.py rename to spacy/tests/lang/de/test_prefix_suffix_infix.py diff --git a/tests/lang/de/test_text.py b/spacy/tests/lang/de/test_text.py similarity index 100% rename from tests/lang/de/test_text.py rename to spacy/tests/lang/de/test_text.py diff --git a/tests/lang/el/__init__.py b/spacy/tests/lang/el/__init__.py similarity index 100% rename from tests/lang/el/__init__.py rename to spacy/tests/lang/el/__init__.py diff --git a/tests/lang/el/test_exception.py b/spacy/tests/lang/el/test_exception.py similarity index 100% rename from tests/lang/el/test_exception.py rename to spacy/tests/lang/el/test_exception.py diff --git a/tests/lang/el/test_text.py b/spacy/tests/lang/el/test_text.py similarity index 100% rename from tests/lang/el/test_text.py rename to spacy/tests/lang/el/test_text.py diff --git a/tests/lang/en/__init__.py b/spacy/tests/lang/en/__init__.py similarity index 100% rename from tests/lang/en/__init__.py rename to spacy/tests/lang/en/__init__.py diff --git a/tests/lang/en/test_customized_tokenizer.py b/spacy/tests/lang/en/test_customized_tokenizer.py similarity index 100% rename from tests/lang/en/test_customized_tokenizer.py rename to spacy/tests/lang/en/test_customized_tokenizer.py diff --git a/tests/lang/en/test_exceptions.py b/spacy/tests/lang/en/test_exceptions.py similarity index 100% rename from tests/lang/en/test_exceptions.py rename to spacy/tests/lang/en/test_exceptions.py diff --git a/tests/lang/en/test_indices.py b/spacy/tests/lang/en/test_indices.py similarity index 100% rename from tests/lang/en/test_indices.py rename to spacy/tests/lang/en/test_indices.py diff --git a/tests/lang/en/test_noun_chunks.py b/spacy/tests/lang/en/test_noun_chunks.py similarity index 100% rename from tests/lang/en/test_noun_chunks.py rename to spacy/tests/lang/en/test_noun_chunks.py diff --git a/tests/lang/en/test_parser.py b/spacy/tests/lang/en/test_parser.py similarity index 100% rename from tests/lang/en/test_parser.py rename to spacy/tests/lang/en/test_parser.py diff --git a/tests/lang/en/test_prefix_suffix_infix.py b/spacy/tests/lang/en/test_prefix_suffix_infix.py similarity index 100% rename from tests/lang/en/test_prefix_suffix_infix.py rename to spacy/tests/lang/en/test_prefix_suffix_infix.py diff --git a/tests/lang/en/test_punct.py b/spacy/tests/lang/en/test_punct.py similarity index 100% rename from tests/lang/en/test_punct.py rename to spacy/tests/lang/en/test_punct.py diff --git a/tests/lang/en/test_sbd.py b/spacy/tests/lang/en/test_sbd.py similarity index 100% rename from tests/lang/en/test_sbd.py rename to spacy/tests/lang/en/test_sbd.py diff --git a/tests/lang/en/test_tagger.py b/spacy/tests/lang/en/test_tagger.py similarity index 100% rename from tests/lang/en/test_tagger.py rename to spacy/tests/lang/en/test_tagger.py diff --git a/tests/lang/en/test_text.py b/spacy/tests/lang/en/test_text.py similarity index 100% rename from tests/lang/en/test_text.py rename to spacy/tests/lang/en/test_text.py diff --git a/tests/lang/es/__init__.py b/spacy/tests/lang/es/__init__.py similarity index 100% rename from tests/lang/es/__init__.py rename to spacy/tests/lang/es/__init__.py diff --git a/tests/lang/es/test_exception.py b/spacy/tests/lang/es/test_exception.py similarity index 100% rename from tests/lang/es/test_exception.py rename to spacy/tests/lang/es/test_exception.py diff --git a/tests/lang/es/test_text.py b/spacy/tests/lang/es/test_text.py similarity index 100% rename from tests/lang/es/test_text.py rename to spacy/tests/lang/es/test_text.py diff --git a/tests/lang/fi/__init__.py b/spacy/tests/lang/fi/__init__.py similarity index 100% rename from tests/lang/fi/__init__.py rename to spacy/tests/lang/fi/__init__.py diff --git a/tests/lang/fi/test_tokenizer.py b/spacy/tests/lang/fi/test_tokenizer.py similarity index 100% rename from tests/lang/fi/test_tokenizer.py rename to spacy/tests/lang/fi/test_tokenizer.py diff --git a/tests/lang/fr/__init__.py b/spacy/tests/lang/fr/__init__.py similarity index 100% rename from tests/lang/fr/__init__.py rename to spacy/tests/lang/fr/__init__.py diff --git a/tests/lang/fr/test_exceptions.py b/spacy/tests/lang/fr/test_exceptions.py similarity index 100% rename from tests/lang/fr/test_exceptions.py rename to spacy/tests/lang/fr/test_exceptions.py diff --git a/tests/lang/fr/test_lemmatization.py b/spacy/tests/lang/fr/test_lemmatization.py similarity index 100% rename from tests/lang/fr/test_lemmatization.py rename to spacy/tests/lang/fr/test_lemmatization.py diff --git a/tests/lang/fr/test_prefix_suffix_infix.py b/spacy/tests/lang/fr/test_prefix_suffix_infix.py similarity index 100% rename from tests/lang/fr/test_prefix_suffix_infix.py rename to spacy/tests/lang/fr/test_prefix_suffix_infix.py diff --git a/tests/lang/fr/test_text.py b/spacy/tests/lang/fr/test_text.py similarity index 100% rename from tests/lang/fr/test_text.py rename to spacy/tests/lang/fr/test_text.py diff --git a/tests/lang/ga/__init__.py b/spacy/tests/lang/ga/__init__.py similarity index 100% rename from tests/lang/ga/__init__.py rename to spacy/tests/lang/ga/__init__.py diff --git a/tests/lang/ga/test_tokenizer.py b/spacy/tests/lang/ga/test_tokenizer.py similarity index 100% rename from tests/lang/ga/test_tokenizer.py rename to spacy/tests/lang/ga/test_tokenizer.py diff --git a/tests/lang/he/__init__.py b/spacy/tests/lang/he/__init__.py similarity index 100% rename from tests/lang/he/__init__.py rename to spacy/tests/lang/he/__init__.py diff --git a/tests/lang/he/test_tokenizer.py b/spacy/tests/lang/he/test_tokenizer.py similarity index 100% rename from tests/lang/he/test_tokenizer.py rename to spacy/tests/lang/he/test_tokenizer.py diff --git a/tests/lang/hr/test_lemma.py b/spacy/tests/lang/hr/test_lemma.py similarity index 100% rename from tests/lang/hr/test_lemma.py rename to spacy/tests/lang/hr/test_lemma.py diff --git a/tests/lang/hu/__init__.py b/spacy/tests/lang/hu/__init__.py similarity index 100% rename from tests/lang/hu/__init__.py rename to spacy/tests/lang/hu/__init__.py diff --git a/tests/lang/hu/test_tokenizer.py b/spacy/tests/lang/hu/test_tokenizer.py similarity index 100% rename from tests/lang/hu/test_tokenizer.py rename to spacy/tests/lang/hu/test_tokenizer.py diff --git a/tests/lang/id/__init__.py b/spacy/tests/lang/id/__init__.py similarity index 100% rename from tests/lang/id/__init__.py rename to spacy/tests/lang/id/__init__.py diff --git a/tests/lang/id/test_prefix_suffix_infix.py b/spacy/tests/lang/id/test_prefix_suffix_infix.py similarity index 100% rename from tests/lang/id/test_prefix_suffix_infix.py rename to spacy/tests/lang/id/test_prefix_suffix_infix.py diff --git a/tests/lang/id/test_text.py b/spacy/tests/lang/id/test_text.py similarity index 100% rename from tests/lang/id/test_text.py rename to spacy/tests/lang/id/test_text.py diff --git a/tests/lang/it/__init__.py b/spacy/tests/lang/it/__init__.py similarity index 100% rename from tests/lang/it/__init__.py rename to spacy/tests/lang/it/__init__.py diff --git a/tests/lang/it/test_prefix_suffix_infix.py b/spacy/tests/lang/it/test_prefix_suffix_infix.py similarity index 100% rename from tests/lang/it/test_prefix_suffix_infix.py rename to spacy/tests/lang/it/test_prefix_suffix_infix.py diff --git a/tests/lang/ja/__init__.py b/spacy/tests/lang/ja/__init__.py similarity index 100% rename from tests/lang/ja/__init__.py rename to spacy/tests/lang/ja/__init__.py diff --git a/tests/lang/ja/test_lemmatization.py b/spacy/tests/lang/ja/test_lemmatization.py similarity index 100% rename from tests/lang/ja/test_lemmatization.py rename to spacy/tests/lang/ja/test_lemmatization.py diff --git a/tests/lang/ja/test_tokenizer.py b/spacy/tests/lang/ja/test_tokenizer.py similarity index 100% rename from tests/lang/ja/test_tokenizer.py rename to spacy/tests/lang/ja/test_tokenizer.py diff --git a/tests/lang/ko/__init__.py b/spacy/tests/lang/ko/__init__.py similarity index 100% rename from tests/lang/ko/__init__.py rename to spacy/tests/lang/ko/__init__.py diff --git a/tests/lang/ko/test_lemmatization.py b/spacy/tests/lang/ko/test_lemmatization.py similarity index 100% rename from tests/lang/ko/test_lemmatization.py rename to spacy/tests/lang/ko/test_lemmatization.py diff --git a/tests/lang/ko/test_tokenizer.py b/spacy/tests/lang/ko/test_tokenizer.py similarity index 100% rename from tests/lang/ko/test_tokenizer.py rename to spacy/tests/lang/ko/test_tokenizer.py diff --git a/tests/lang/lt/__init__.py b/spacy/tests/lang/lt/__init__.py similarity index 100% rename from tests/lang/lt/__init__.py rename to spacy/tests/lang/lt/__init__.py diff --git a/tests/lang/lt/test_lemmatizer.py b/spacy/tests/lang/lt/test_lemmatizer.py similarity index 100% rename from tests/lang/lt/test_lemmatizer.py rename to spacy/tests/lang/lt/test_lemmatizer.py diff --git a/tests/lang/lt/test_text.py b/spacy/tests/lang/lt/test_text.py similarity index 100% rename from tests/lang/lt/test_text.py rename to spacy/tests/lang/lt/test_text.py diff --git a/tests/lang/nb/__init__.py b/spacy/tests/lang/nb/__init__.py similarity index 100% rename from tests/lang/nb/__init__.py rename to spacy/tests/lang/nb/__init__.py diff --git a/tests/lang/nb/test_tokenizer.py b/spacy/tests/lang/nb/test_tokenizer.py similarity index 100% rename from tests/lang/nb/test_tokenizer.py rename to spacy/tests/lang/nb/test_tokenizer.py diff --git a/tests/lang/nl/__init__.py b/spacy/tests/lang/nl/__init__.py similarity index 100% rename from tests/lang/nl/__init__.py rename to spacy/tests/lang/nl/__init__.py diff --git a/tests/lang/nl/test_lemmatizer.py b/spacy/tests/lang/nl/test_lemmatizer.py similarity index 100% rename from tests/lang/nl/test_lemmatizer.py rename to spacy/tests/lang/nl/test_lemmatizer.py diff --git a/tests/lang/nl/test_text.py b/spacy/tests/lang/nl/test_text.py similarity index 100% rename from tests/lang/nl/test_text.py rename to spacy/tests/lang/nl/test_text.py diff --git a/tests/lang/pl/__init__.py b/spacy/tests/lang/pl/__init__.py similarity index 100% rename from tests/lang/pl/__init__.py rename to spacy/tests/lang/pl/__init__.py diff --git a/tests/lang/pl/test_text.py b/spacy/tests/lang/pl/test_text.py similarity index 100% rename from tests/lang/pl/test_text.py rename to spacy/tests/lang/pl/test_text.py diff --git a/tests/lang/pl/test_tokenizer.py b/spacy/tests/lang/pl/test_tokenizer.py similarity index 100% rename from tests/lang/pl/test_tokenizer.py rename to spacy/tests/lang/pl/test_tokenizer.py diff --git a/tests/lang/pt/__init__.py b/spacy/tests/lang/pt/__init__.py similarity index 100% rename from tests/lang/pt/__init__.py rename to spacy/tests/lang/pt/__init__.py diff --git a/tests/lang/pt/test_text.py b/spacy/tests/lang/pt/test_text.py similarity index 100% rename from tests/lang/pt/test_text.py rename to spacy/tests/lang/pt/test_text.py diff --git a/tests/lang/ro/__init__.py b/spacy/tests/lang/ro/__init__.py similarity index 100% rename from tests/lang/ro/__init__.py rename to spacy/tests/lang/ro/__init__.py diff --git a/tests/lang/ro/test_lemmatizer.py b/spacy/tests/lang/ro/test_lemmatizer.py similarity index 100% rename from tests/lang/ro/test_lemmatizer.py rename to spacy/tests/lang/ro/test_lemmatizer.py diff --git a/tests/lang/ro/test_tokenizer.py b/spacy/tests/lang/ro/test_tokenizer.py similarity index 100% rename from tests/lang/ro/test_tokenizer.py rename to spacy/tests/lang/ro/test_tokenizer.py diff --git a/tests/lang/ru/__init__.py b/spacy/tests/lang/ru/__init__.py similarity index 100% rename from tests/lang/ru/__init__.py rename to spacy/tests/lang/ru/__init__.py diff --git a/tests/lang/ru/test_exceptions.py b/spacy/tests/lang/ru/test_exceptions.py similarity index 100% rename from tests/lang/ru/test_exceptions.py rename to spacy/tests/lang/ru/test_exceptions.py diff --git a/tests/lang/ru/test_lemmatizer.py b/spacy/tests/lang/ru/test_lemmatizer.py similarity index 100% rename from tests/lang/ru/test_lemmatizer.py rename to spacy/tests/lang/ru/test_lemmatizer.py diff --git a/tests/lang/ru/test_text.py b/spacy/tests/lang/ru/test_text.py similarity index 100% rename from tests/lang/ru/test_text.py rename to spacy/tests/lang/ru/test_text.py diff --git a/tests/lang/ru/test_tokenizer.py b/spacy/tests/lang/ru/test_tokenizer.py similarity index 100% rename from tests/lang/ru/test_tokenizer.py rename to spacy/tests/lang/ru/test_tokenizer.py diff --git a/tests/lang/sr/__init__.py b/spacy/tests/lang/sr/__init__.py similarity index 100% rename from tests/lang/sr/__init__.py rename to spacy/tests/lang/sr/__init__.py diff --git a/tests/lang/sr/test_exceptions.py b/spacy/tests/lang/sr/test_exceptions.py similarity index 100% rename from tests/lang/sr/test_exceptions.py rename to spacy/tests/lang/sr/test_exceptions.py diff --git a/tests/lang/sr/test_lemmatizer.py b/spacy/tests/lang/sr/test_lemmatizer.py similarity index 100% rename from tests/lang/sr/test_lemmatizer.py rename to spacy/tests/lang/sr/test_lemmatizer.py diff --git a/tests/lang/sr/test_tokenizer.py b/spacy/tests/lang/sr/test_tokenizer.py similarity index 100% rename from tests/lang/sr/test_tokenizer.py rename to spacy/tests/lang/sr/test_tokenizer.py diff --git a/tests/lang/sv/__init__.py b/spacy/tests/lang/sv/__init__.py similarity index 100% rename from tests/lang/sv/__init__.py rename to spacy/tests/lang/sv/__init__.py diff --git a/tests/lang/sv/test_exceptions.py b/spacy/tests/lang/sv/test_exceptions.py similarity index 100% rename from tests/lang/sv/test_exceptions.py rename to spacy/tests/lang/sv/test_exceptions.py diff --git a/tests/lang/sv/test_lemmatizer.py b/spacy/tests/lang/sv/test_lemmatizer.py similarity index 100% rename from tests/lang/sv/test_lemmatizer.py rename to spacy/tests/lang/sv/test_lemmatizer.py diff --git a/tests/lang/sv/test_prefix_suffix_infix.py b/spacy/tests/lang/sv/test_prefix_suffix_infix.py similarity index 100% rename from tests/lang/sv/test_prefix_suffix_infix.py rename to spacy/tests/lang/sv/test_prefix_suffix_infix.py diff --git a/tests/lang/sv/test_text.py b/spacy/tests/lang/sv/test_text.py similarity index 100% rename from tests/lang/sv/test_text.py rename to spacy/tests/lang/sv/test_text.py diff --git a/tests/lang/sv/test_tokenizer.py b/spacy/tests/lang/sv/test_tokenizer.py similarity index 100% rename from tests/lang/sv/test_tokenizer.py rename to spacy/tests/lang/sv/test_tokenizer.py diff --git a/tests/lang/test_attrs.py b/spacy/tests/lang/test_attrs.py similarity index 100% rename from tests/lang/test_attrs.py rename to spacy/tests/lang/test_attrs.py diff --git a/tests/lang/test_initialize.py b/spacy/tests/lang/test_initialize.py similarity index 100% rename from tests/lang/test_initialize.py rename to spacy/tests/lang/test_initialize.py diff --git a/tests/lang/th/__init__.py b/spacy/tests/lang/th/__init__.py similarity index 100% rename from tests/lang/th/__init__.py rename to spacy/tests/lang/th/__init__.py diff --git a/tests/lang/th/test_tokenizer.py b/spacy/tests/lang/th/test_tokenizer.py similarity index 100% rename from tests/lang/th/test_tokenizer.py rename to spacy/tests/lang/th/test_tokenizer.py diff --git a/tests/lang/tr/__init__.py b/spacy/tests/lang/tr/__init__.py similarity index 100% rename from tests/lang/tr/__init__.py rename to spacy/tests/lang/tr/__init__.py diff --git a/tests/lang/tr/test_lemmatization.py b/spacy/tests/lang/tr/test_lemmatization.py similarity index 100% rename from tests/lang/tr/test_lemmatization.py rename to spacy/tests/lang/tr/test_lemmatization.py diff --git a/tests/lang/tt/__init__.py b/spacy/tests/lang/tt/__init__.py similarity index 100% rename from tests/lang/tt/__init__.py rename to spacy/tests/lang/tt/__init__.py diff --git a/tests/lang/tt/test_tokenizer.py b/spacy/tests/lang/tt/test_tokenizer.py similarity index 100% rename from tests/lang/tt/test_tokenizer.py rename to spacy/tests/lang/tt/test_tokenizer.py diff --git a/tests/lang/uk/__init__.py b/spacy/tests/lang/uk/__init__.py similarity index 100% rename from tests/lang/uk/__init__.py rename to spacy/tests/lang/uk/__init__.py diff --git a/tests/lang/uk/test_tokenizer.py b/spacy/tests/lang/uk/test_tokenizer.py similarity index 100% rename from tests/lang/uk/test_tokenizer.py rename to spacy/tests/lang/uk/test_tokenizer.py diff --git a/tests/lang/uk/test_tokenizer_exc.py b/spacy/tests/lang/uk/test_tokenizer_exc.py similarity index 100% rename from tests/lang/uk/test_tokenizer_exc.py rename to spacy/tests/lang/uk/test_tokenizer_exc.py diff --git a/tests/lang/ur/__init__.py b/spacy/tests/lang/ur/__init__.py similarity index 100% rename from tests/lang/ur/__init__.py rename to spacy/tests/lang/ur/__init__.py diff --git a/tests/lang/ur/test_prefix_suffix_infix.py b/spacy/tests/lang/ur/test_prefix_suffix_infix.py similarity index 100% rename from tests/lang/ur/test_prefix_suffix_infix.py rename to spacy/tests/lang/ur/test_prefix_suffix_infix.py diff --git a/tests/lang/ur/test_text.py b/spacy/tests/lang/ur/test_text.py similarity index 100% rename from tests/lang/ur/test_text.py rename to spacy/tests/lang/ur/test_text.py diff --git a/tests/matcher/__init__.py b/spacy/tests/matcher/__init__.py similarity index 100% rename from tests/matcher/__init__.py rename to spacy/tests/matcher/__init__.py diff --git a/tests/matcher/test_matcher_api.py b/spacy/tests/matcher/test_matcher_api.py similarity index 100% rename from tests/matcher/test_matcher_api.py rename to spacy/tests/matcher/test_matcher_api.py diff --git a/tests/matcher/test_matcher_logic.py b/spacy/tests/matcher/test_matcher_logic.py similarity index 100% rename from tests/matcher/test_matcher_logic.py rename to spacy/tests/matcher/test_matcher_logic.py diff --git a/tests/matcher/test_pattern_validation.py b/spacy/tests/matcher/test_pattern_validation.py similarity index 100% rename from tests/matcher/test_pattern_validation.py rename to spacy/tests/matcher/test_pattern_validation.py diff --git a/tests/matcher/test_phrase_matcher.py b/spacy/tests/matcher/test_phrase_matcher.py similarity index 100% rename from tests/matcher/test_phrase_matcher.py rename to spacy/tests/matcher/test_phrase_matcher.py diff --git a/tests/morphology/__init__.py b/spacy/tests/morphology/__init__.py similarity index 100% rename from tests/morphology/__init__.py rename to spacy/tests/morphology/__init__.py diff --git a/tests/morphology/test_morph_features.py b/spacy/tests/morphology/test_morph_features.py similarity index 100% rename from tests/morphology/test_morph_features.py rename to spacy/tests/morphology/test_morph_features.py diff --git a/tests/parser/__init__.py b/spacy/tests/parser/__init__.py similarity index 100% rename from tests/parser/__init__.py rename to spacy/tests/parser/__init__.py diff --git a/tests/parser/test_add_label.py b/spacy/tests/parser/test_add_label.py similarity index 100% rename from tests/parser/test_add_label.py rename to spacy/tests/parser/test_add_label.py diff --git a/tests/parser/test_arc_eager_oracle.py b/spacy/tests/parser/test_arc_eager_oracle.py similarity index 100% rename from tests/parser/test_arc_eager_oracle.py rename to spacy/tests/parser/test_arc_eager_oracle.py diff --git a/tests/parser/test_ner.py b/spacy/tests/parser/test_ner.py similarity index 100% rename from tests/parser/test_ner.py rename to spacy/tests/parser/test_ner.py diff --git a/tests/parser/test_neural_parser.py b/spacy/tests/parser/test_neural_parser.py similarity index 100% rename from tests/parser/test_neural_parser.py rename to spacy/tests/parser/test_neural_parser.py diff --git a/tests/parser/test_nn_beam.py b/spacy/tests/parser/test_nn_beam.py similarity index 100% rename from tests/parser/test_nn_beam.py rename to spacy/tests/parser/test_nn_beam.py diff --git a/tests/parser/test_nonproj.py b/spacy/tests/parser/test_nonproj.py similarity index 100% rename from tests/parser/test_nonproj.py rename to spacy/tests/parser/test_nonproj.py diff --git a/tests/parser/test_parse.py b/spacy/tests/parser/test_parse.py similarity index 100% rename from tests/parser/test_parse.py rename to spacy/tests/parser/test_parse.py diff --git a/tests/parser/test_parse_navigate.py b/spacy/tests/parser/test_parse_navigate.py similarity index 100% rename from tests/parser/test_parse_navigate.py rename to spacy/tests/parser/test_parse_navigate.py diff --git a/tests/parser/test_preset_sbd.py b/spacy/tests/parser/test_preset_sbd.py similarity index 100% rename from tests/parser/test_preset_sbd.py rename to spacy/tests/parser/test_preset_sbd.py diff --git a/tests/parser/test_space_attachment.py b/spacy/tests/parser/test_space_attachment.py similarity index 100% rename from tests/parser/test_space_attachment.py rename to spacy/tests/parser/test_space_attachment.py diff --git a/tests/pipeline/__init__.py b/spacy/tests/pipeline/__init__.py similarity index 100% rename from tests/pipeline/__init__.py rename to spacy/tests/pipeline/__init__.py diff --git a/tests/pipeline/test_entity_linker.py b/spacy/tests/pipeline/test_entity_linker.py similarity index 100% rename from tests/pipeline/test_entity_linker.py rename to spacy/tests/pipeline/test_entity_linker.py diff --git a/tests/pipeline/test_entity_ruler.py b/spacy/tests/pipeline/test_entity_ruler.py similarity index 100% rename from tests/pipeline/test_entity_ruler.py rename to spacy/tests/pipeline/test_entity_ruler.py diff --git a/tests/pipeline/test_factories.py b/spacy/tests/pipeline/test_factories.py similarity index 100% rename from tests/pipeline/test_factories.py rename to spacy/tests/pipeline/test_factories.py diff --git a/tests/pipeline/test_pipe_methods.py b/spacy/tests/pipeline/test_pipe_methods.py similarity index 100% rename from tests/pipeline/test_pipe_methods.py rename to spacy/tests/pipeline/test_pipe_methods.py diff --git a/tests/pipeline/test_sentencizer.py b/spacy/tests/pipeline/test_sentencizer.py similarity index 100% rename from tests/pipeline/test_sentencizer.py rename to spacy/tests/pipeline/test_sentencizer.py diff --git a/tests/pipeline/test_textcat.py b/spacy/tests/pipeline/test_textcat.py similarity index 100% rename from tests/pipeline/test_textcat.py rename to spacy/tests/pipeline/test_textcat.py diff --git a/tests/regression/__init__.py b/spacy/tests/regression/__init__.py similarity index 100% rename from tests/regression/__init__.py rename to spacy/tests/regression/__init__.py diff --git a/tests/regression/test_issue1-1000.py b/spacy/tests/regression/test_issue1-1000.py similarity index 100% rename from tests/regression/test_issue1-1000.py rename to spacy/tests/regression/test_issue1-1000.py diff --git a/tests/regression/test_issue1001-1500.py b/spacy/tests/regression/test_issue1001-1500.py similarity index 100% rename from tests/regression/test_issue1001-1500.py rename to spacy/tests/regression/test_issue1001-1500.py diff --git a/tests/regression/test_issue1501-2000.py b/spacy/tests/regression/test_issue1501-2000.py similarity index 100% rename from tests/regression/test_issue1501-2000.py rename to spacy/tests/regression/test_issue1501-2000.py diff --git a/tests/regression/test_issue2001-2500.py b/spacy/tests/regression/test_issue2001-2500.py similarity index 100% rename from tests/regression/test_issue2001-2500.py rename to spacy/tests/regression/test_issue2001-2500.py diff --git a/tests/regression/test_issue2501-3000.py b/spacy/tests/regression/test_issue2501-3000.py similarity index 100% rename from tests/regression/test_issue2501-3000.py rename to spacy/tests/regression/test_issue2501-3000.py diff --git a/tests/regression/test_issue3001-3500.py b/spacy/tests/regression/test_issue3001-3500.py similarity index 100% rename from tests/regression/test_issue3001-3500.py rename to spacy/tests/regression/test_issue3001-3500.py diff --git a/tests/regression/test_issue3521.py b/spacy/tests/regression/test_issue3521.py similarity index 100% rename from tests/regression/test_issue3521.py rename to spacy/tests/regression/test_issue3521.py diff --git a/tests/regression/test_issue3526.py b/spacy/tests/regression/test_issue3526.py similarity index 100% rename from tests/regression/test_issue3526.py rename to spacy/tests/regression/test_issue3526.py diff --git a/tests/regression/test_issue3531.py b/spacy/tests/regression/test_issue3531.py similarity index 100% rename from tests/regression/test_issue3531.py rename to spacy/tests/regression/test_issue3531.py diff --git a/tests/regression/test_issue3540.py b/spacy/tests/regression/test_issue3540.py similarity index 100% rename from tests/regression/test_issue3540.py rename to spacy/tests/regression/test_issue3540.py diff --git a/tests/regression/test_issue3549.py b/spacy/tests/regression/test_issue3549.py similarity index 100% rename from tests/regression/test_issue3549.py rename to spacy/tests/regression/test_issue3549.py diff --git a/tests/regression/test_issue3555.py b/spacy/tests/regression/test_issue3555.py similarity index 100% rename from tests/regression/test_issue3555.py rename to spacy/tests/regression/test_issue3555.py diff --git a/tests/regression/test_issue3611.py b/spacy/tests/regression/test_issue3611.py similarity index 100% rename from tests/regression/test_issue3611.py rename to spacy/tests/regression/test_issue3611.py diff --git a/tests/regression/test_issue3625.py b/spacy/tests/regression/test_issue3625.py similarity index 100% rename from tests/regression/test_issue3625.py rename to spacy/tests/regression/test_issue3625.py diff --git a/tests/regression/test_issue3803.py b/spacy/tests/regression/test_issue3803.py similarity index 100% rename from tests/regression/test_issue3803.py rename to spacy/tests/regression/test_issue3803.py diff --git a/tests/regression/test_issue3830.py b/spacy/tests/regression/test_issue3830.py similarity index 100% rename from tests/regression/test_issue3830.py rename to spacy/tests/regression/test_issue3830.py diff --git a/tests/regression/test_issue3839.py b/spacy/tests/regression/test_issue3839.py similarity index 100% rename from tests/regression/test_issue3839.py rename to spacy/tests/regression/test_issue3839.py diff --git a/tests/regression/test_issue3869.py b/spacy/tests/regression/test_issue3869.py similarity index 100% rename from tests/regression/test_issue3869.py rename to spacy/tests/regression/test_issue3869.py diff --git a/tests/regression/test_issue3879.py b/spacy/tests/regression/test_issue3879.py similarity index 100% rename from tests/regression/test_issue3879.py rename to spacy/tests/regression/test_issue3879.py diff --git a/tests/regression/test_issue3880.py b/spacy/tests/regression/test_issue3880.py similarity index 100% rename from tests/regression/test_issue3880.py rename to spacy/tests/regression/test_issue3880.py diff --git a/tests/regression/test_issue3882.py b/spacy/tests/regression/test_issue3882.py similarity index 100% rename from tests/regression/test_issue3882.py rename to spacy/tests/regression/test_issue3882.py diff --git a/tests/regression/test_issue3951.py b/spacy/tests/regression/test_issue3951.py similarity index 100% rename from tests/regression/test_issue3951.py rename to spacy/tests/regression/test_issue3951.py diff --git a/tests/regression/test_issue3959.py b/spacy/tests/regression/test_issue3959.py similarity index 100% rename from tests/regression/test_issue3959.py rename to spacy/tests/regression/test_issue3959.py diff --git a/tests/regression/test_issue3962.py b/spacy/tests/regression/test_issue3962.py similarity index 100% rename from tests/regression/test_issue3962.py rename to spacy/tests/regression/test_issue3962.py diff --git a/tests/regression/test_issue3972.py b/spacy/tests/regression/test_issue3972.py similarity index 100% rename from tests/regression/test_issue3972.py rename to spacy/tests/regression/test_issue3972.py diff --git a/tests/regression/test_issue4002.py b/spacy/tests/regression/test_issue4002.py similarity index 100% rename from tests/regression/test_issue4002.py rename to spacy/tests/regression/test_issue4002.py diff --git a/tests/regression/test_issue4030.py b/spacy/tests/regression/test_issue4030.py similarity index 100% rename from tests/regression/test_issue4030.py rename to spacy/tests/regression/test_issue4030.py diff --git a/tests/regression/test_issue4042.py b/spacy/tests/regression/test_issue4042.py similarity index 98% rename from tests/regression/test_issue4042.py rename to spacy/tests/regression/test_issue4042.py index 152cf3cdc..73872df0b 100644 --- a/tests/regression/test_issue4042.py +++ b/spacy/tests/regression/test_issue4042.py @@ -6,11 +6,10 @@ import spacy from spacy.pipeline import EntityRecognizer, EntityRuler from spacy.lang.en import English +from spacy.tests.util import make_tempdir from spacy.tokens import Span from spacy.util import ensure_path -from ..util import make_tempdir - def test_issue4042(): """Test that serialization of an EntityRuler before NER works fine.""" diff --git a/tests/regression/test_issue4054.py b/spacy/tests/regression/test_issue4054.py similarity index 95% rename from tests/regression/test_issue4054.py rename to spacy/tests/regression/test_issue4054.py index 8a263689c..2c9d73751 100644 --- a/tests/regression/test_issue4054.py +++ b/spacy/tests/regression/test_issue4054.py @@ -5,10 +5,9 @@ from spacy.vocab import Vocab import spacy from spacy.lang.en import English +from spacy.tests.util import make_tempdir from spacy.util import ensure_path -from ..util import make_tempdir - def test_issue4054(en_vocab): """Test that a new blank model can be made with a vocab from file, diff --git a/tests/regression/test_issue4104.py b/spacy/tests/regression/test_issue4104.py similarity index 100% rename from tests/regression/test_issue4104.py rename to spacy/tests/regression/test_issue4104.py diff --git a/tests/regression/test_issue4120.py b/spacy/tests/regression/test_issue4120.py similarity index 100% rename from tests/regression/test_issue4120.py rename to spacy/tests/regression/test_issue4120.py diff --git a/tests/regression/test_issue4133.py b/spacy/tests/regression/test_issue4133.py similarity index 100% rename from tests/regression/test_issue4133.py rename to spacy/tests/regression/test_issue4133.py diff --git a/tests/regression/test_issue4190.py b/spacy/tests/regression/test_issue4190.py similarity index 100% rename from tests/regression/test_issue4190.py rename to spacy/tests/regression/test_issue4190.py diff --git a/tests/regression/test_issue4267.py b/spacy/tests/regression/test_issue4267.py similarity index 100% rename from tests/regression/test_issue4267.py rename to spacy/tests/regression/test_issue4267.py diff --git a/tests/regression/test_issue4272.py b/spacy/tests/regression/test_issue4272.py similarity index 100% rename from tests/regression/test_issue4272.py rename to spacy/tests/regression/test_issue4272.py diff --git a/tests/regression/test_issue4278.py b/spacy/tests/regression/test_issue4278.py similarity index 100% rename from tests/regression/test_issue4278.py rename to spacy/tests/regression/test_issue4278.py diff --git a/tests/regression/test_issue4313.py b/spacy/tests/regression/test_issue4313.py similarity index 100% rename from tests/regression/test_issue4313.py rename to spacy/tests/regression/test_issue4313.py diff --git a/tests/serialize/__init__.py b/spacy/tests/serialize/__init__.py similarity index 100% rename from tests/serialize/__init__.py rename to spacy/tests/serialize/__init__.py diff --git a/tests/serialize/test_serialize_doc.py b/spacy/tests/serialize/test_serialize_doc.py similarity index 100% rename from tests/serialize/test_serialize_doc.py rename to spacy/tests/serialize/test_serialize_doc.py diff --git a/tests/serialize/test_serialize_extension_attrs.py b/spacy/tests/serialize/test_serialize_extension_attrs.py similarity index 100% rename from tests/serialize/test_serialize_extension_attrs.py rename to spacy/tests/serialize/test_serialize_extension_attrs.py diff --git a/tests/serialize/test_serialize_kb.py b/spacy/tests/serialize/test_serialize_kb.py similarity index 98% rename from tests/serialize/test_serialize_kb.py rename to spacy/tests/serialize/test_serialize_kb.py index b19c11864..67fd9f0d4 100644 --- a/tests/serialize/test_serialize_kb.py +++ b/spacy/tests/serialize/test_serialize_kb.py @@ -1,10 +1,10 @@ # coding: utf-8 from __future__ import unicode_literals -from spacy.util import ensure_path -from spacy.kb import KnowledgeBase - from ..util import make_tempdir +from ...util import ensure_path + +from spacy.kb import KnowledgeBase def test_serialize_kb_disk(en_vocab): diff --git a/tests/serialize/test_serialize_language.py b/spacy/tests/serialize/test_serialize_language.py similarity index 100% rename from tests/serialize/test_serialize_language.py rename to spacy/tests/serialize/test_serialize_language.py diff --git a/tests/serialize/test_serialize_pipeline.py b/spacy/tests/serialize/test_serialize_pipeline.py similarity index 100% rename from tests/serialize/test_serialize_pipeline.py rename to spacy/tests/serialize/test_serialize_pipeline.py diff --git a/tests/serialize/test_serialize_tokenizer.py b/spacy/tests/serialize/test_serialize_tokenizer.py similarity index 100% rename from tests/serialize/test_serialize_tokenizer.py rename to spacy/tests/serialize/test_serialize_tokenizer.py diff --git a/tests/serialize/test_serialize_vocab_strings.py b/spacy/tests/serialize/test_serialize_vocab_strings.py similarity index 100% rename from tests/serialize/test_serialize_vocab_strings.py rename to spacy/tests/serialize/test_serialize_vocab_strings.py diff --git a/tests/test_align.py b/spacy/tests/test_align.py similarity index 100% rename from tests/test_align.py rename to spacy/tests/test_align.py diff --git a/tests/test_cli.py b/spacy/tests/test_cli.py similarity index 100% rename from tests/test_cli.py rename to spacy/tests/test_cli.py diff --git a/tests/test_displacy.py b/spacy/tests/test_displacy.py similarity index 100% rename from tests/test_displacy.py rename to spacy/tests/test_displacy.py diff --git a/tests/test_gold.py b/spacy/tests/test_gold.py similarity index 100% rename from tests/test_gold.py rename to spacy/tests/test_gold.py diff --git a/tests/test_json_schemas.py b/spacy/tests/test_json_schemas.py similarity index 100% rename from tests/test_json_schemas.py rename to spacy/tests/test_json_schemas.py diff --git a/tests/test_language.py b/spacy/tests/test_language.py similarity index 100% rename from tests/test_language.py rename to spacy/tests/test_language.py diff --git a/tests/test_misc.py b/spacy/tests/test_misc.py similarity index 100% rename from tests/test_misc.py rename to spacy/tests/test_misc.py diff --git a/tests/test_pickles.py b/spacy/tests/test_pickles.py similarity index 100% rename from tests/test_pickles.py rename to spacy/tests/test_pickles.py diff --git a/tests/test_scorer.py b/spacy/tests/test_scorer.py similarity index 100% rename from tests/test_scorer.py rename to spacy/tests/test_scorer.py diff --git a/tests/tokenizer/__init__.py b/spacy/tests/tokenizer/__init__.py similarity index 100% rename from tests/tokenizer/__init__.py rename to spacy/tests/tokenizer/__init__.py diff --git a/tests/tokenizer/sun.txt b/spacy/tests/tokenizer/sun.txt similarity index 100% rename from tests/tokenizer/sun.txt rename to spacy/tests/tokenizer/sun.txt diff --git a/tests/tokenizer/test_exceptions.py b/spacy/tests/tokenizer/test_exceptions.py similarity index 100% rename from tests/tokenizer/test_exceptions.py rename to spacy/tests/tokenizer/test_exceptions.py diff --git a/tests/tokenizer/test_naughty_strings.py b/spacy/tests/tokenizer/test_naughty_strings.py similarity index 100% rename from tests/tokenizer/test_naughty_strings.py rename to spacy/tests/tokenizer/test_naughty_strings.py diff --git a/tests/tokenizer/test_tokenizer.py b/spacy/tests/tokenizer/test_tokenizer.py similarity index 100% rename from tests/tokenizer/test_tokenizer.py rename to spacy/tests/tokenizer/test_tokenizer.py diff --git a/tests/tokenizer/test_urls.py b/spacy/tests/tokenizer/test_urls.py similarity index 100% rename from tests/tokenizer/test_urls.py rename to spacy/tests/tokenizer/test_urls.py diff --git a/tests/tokenizer/test_whitespace.py b/spacy/tests/tokenizer/test_whitespace.py similarity index 100% rename from tests/tokenizer/test_whitespace.py rename to spacy/tests/tokenizer/test_whitespace.py diff --git a/tests/util.py b/spacy/tests/util.py similarity index 100% rename from tests/util.py rename to spacy/tests/util.py diff --git a/tests/vocab_vectors/__init__.py b/spacy/tests/vocab_vectors/__init__.py similarity index 100% rename from tests/vocab_vectors/__init__.py rename to spacy/tests/vocab_vectors/__init__.py diff --git a/tests/vocab_vectors/test_lexeme.py b/spacy/tests/vocab_vectors/test_lexeme.py similarity index 100% rename from tests/vocab_vectors/test_lexeme.py rename to spacy/tests/vocab_vectors/test_lexeme.py diff --git a/tests/vocab_vectors/test_lookups.py b/spacy/tests/vocab_vectors/test_lookups.py similarity index 100% rename from tests/vocab_vectors/test_lookups.py rename to spacy/tests/vocab_vectors/test_lookups.py diff --git a/tests/vocab_vectors/test_similarity.py b/spacy/tests/vocab_vectors/test_similarity.py similarity index 100% rename from tests/vocab_vectors/test_similarity.py rename to spacy/tests/vocab_vectors/test_similarity.py diff --git a/tests/vocab_vectors/test_stringstore.py b/spacy/tests/vocab_vectors/test_stringstore.py similarity index 100% rename from tests/vocab_vectors/test_stringstore.py rename to spacy/tests/vocab_vectors/test_stringstore.py diff --git a/tests/vocab_vectors/test_vectors.py b/spacy/tests/vocab_vectors/test_vectors.py similarity index 100% rename from tests/vocab_vectors/test_vectors.py rename to spacy/tests/vocab_vectors/test_vectors.py diff --git a/tests/vocab_vectors/test_vocab_api.py b/spacy/tests/vocab_vectors/test_vocab_api.py similarity index 100% rename from tests/vocab_vectors/test_vocab_api.py rename to spacy/tests/vocab_vectors/test_vocab_api.py diff --git a/website/docs/usage/adding-languages.md b/website/docs/usage/adding-languages.md index 097aa9888..94d75ea31 100644 --- a/website/docs/usage/adding-languages.md +++ b/website/docs/usage/adding-languages.md @@ -543,7 +543,7 @@ be causing regressions. spaCy uses the [pytest framework](https://docs.pytest.org/en/latest/) for testing. For more details on how the tests are structured and best practices for writing your own tests, see our -[tests documentation](https://github.com/explosion/spaCy/tree/master/tests). +[tests documentation](https://github.com/explosion/spaCy/tree/master/spacy/tests). @@ -551,10 +551,10 @@ writing your own tests, see our It's recommended to always add at least some tests with examples specific to the language. Language tests should be located in -[`tests/lang`](https://github.com/explosion/spaCy/tree/master/tests/lang) in a -directory named after the language ID. You'll also need to create a fixture for -your tokenizer in the -[`conftest.py`](https://github.com/explosion/spaCy/tree/master/tests/conftest.py). +[`tests/lang`](https://github.com/explosion/spaCy/tree/master/spacy/tests/lang) +in a directory named after the language ID. You'll also need to create a fixture +for your tokenizer in the +[`conftest.py`](https://github.com/explosion/spaCy/tree/master/spacy/tests/conftest.py). Always use the [`get_lang_class`](/api/top-level#util.get_lang_class) helper function within the fixture, instead of importing the class at the top of the file. This will load the language data only when it's needed. (Otherwise, _all @@ -567,7 +567,7 @@ def en_tokenizer(): ``` When adding test cases, always -[`parametrize`](https://github.com/explosion/spaCy/tree/master/tests#parameters) +[`parametrize`](https://github.com/explosion/spaCy/tree/master/spacy/tests#parameters) them – this will make it easier for others to add more test cases without having to modify the test itself. You can also add parameter tuples, for example, a test sentence and its expected length, or a list of expected tokens. Here's an diff --git a/website/docs/usage/index.md b/website/docs/usage/index.md index 5faefb415..1d6c0574c 100644 --- a/website/docs/usage/index.md +++ b/website/docs/usage/index.md @@ -197,8 +197,8 @@ official distributions these are: ### Run tests {#run-tests} spaCy comes with an -[extensive test suite](https://github.com/explosion/spaCy/tree/master/tests). In -order to run the tests, you'll usually want to clone the +[extensive test suite](https://github.com/explosion/spaCy/tree/master/spacy/tests). +In order to run the tests, you'll usually want to clone the [repository](https://github.com/explosion/spaCy/tree/master/) and [build spaCy from source](#source). This will also install the required development dependencies and test utilities defined in the `requirements.txt`.