Include full tests/ tree in sdist via MANIFEST.in - #367
Open
sak7122 wants to merge 1 commit into
Open
Conversation
Setuptools' default sdist file-finder only auto-includes files matching tests/test*.py, so tests/__init__.py, tests/compliance/*.json, and tests/legacy/*.json were silently dropped from the sdist built for the 1.1.0 release. That breaks pytest when run against the sdist, since tests/test_compliance.py does `from tests import OrderedDict`. Fixes jmespath#341
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.
Summary
Fixes #341.
setuptools' default sdist file-finder only auto-includes files matching thetests/test*.pyglob. It silently dropstests/__init__.py,tests/compliance/*.json, andtests/legacy/*.json, none of which match that pattern. That's why the sdist published for 1.1.0 is missingtests/__init__.py:test_compliance.pydoesfrom tests import OrderedDict, which fails once the sdist is extracted and tests are run against it, exactly as reported in #341.MANIFEST.innever listed thetests/directory at all — the previously-"working" inclusion oftests/test_*.pywas always justsetuptools' default optional glob, which happens to miss everything else undertests/.The fix adds one line to
MANIFEST.into explicitly include the entiretests/tree (source files + JSON fixtures + subdirectories), rather than relying on the incomplete default heuristic.Test plan
Built and ran the actual sdist end-to-end locally:
git diffbefore/after this change: before,python setup.py egg_info's generatedSOURCES.txtliststests/test_*.pybut omitstests/__init__.py,tests/compliance/*.json, andtests/legacy/*.json.MANIFEST.inchange:python -m build --sdistproduces a tarball whosetests/directory now contains all of__init__.py,compliance/*.json(16 files), andlegacy/literal.json, matching the full contents of the repo'stests/directory.pip installed it into a fresh venv, and ranpytestfromtests/against the installed package: 991 passed, 1 skipped, with no import errors (previously this would fail at collection withImportError: cannot import name 'OrderedDict' from 'tests', per the traceback in sdist is missingtests/__init__.py#341).Platform tested: Windows 11 (Python 3.14).