Repository navigation
Only expect ml_datasets registry entries when ml_datasets is installed - #14092
Open
AsadullahMaliyawala wants to merge 1 commit into
Open
AsadullahMaliyawala wants to merge 1 commit into
AsadullahMaliyawala wants to merge 1 commit into
Conversation
ml_datasets registers its readers through entry points and is a development requirement, not an install requirement, so running the test suite against an installed spaCy (python -m pytest --pyargs spacy) without it failed test_registry_entries. Fixes explosion#13856
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Running the test suite against an installed spaCy (
python -m pytest --pyargs spacy, as described in the README) fails intest_registry_entrieswhenml_datasetsis not installed:registry_contents.jsonlists the threeml_datasets.*readers, but they are registered by theml_datasetspackage through entry points.ml_datasetsis only inrequirements.txt(development), not ininstall_requires, so a plainpip install spacy(or a distro package, as in #13856 on NixOS) does not have them.The test now only expects entries from optional entry-point packages when that package is importable (
OPTIONAL_ENTRY_PREFIXES, currently justml_datasets). Withml_datasetsinstalled the check is unchanged. This follows how the rest of the suite treats optional dependencies (pytest.importorskipinconftest.py).Fixes #13856
Reproduced with spaCy 3.8.20 (current master) on Python 3.12 without
ml_datasets:test_registry_population.py1 failed / 2 passed before, 3 passed after.ruff format --checkclean on the file.I used an AI coding assistant (Claude) while investigating this; I reproduced the failure and ran the tests myself.
Types of change
Test fix.
Checklist