Ignore editable installation modules (#10231)

Fixes #10230
This commit is contained in:
Gergely Kalmár 2022-08-26 14:46:47 +02:00 committed by GitHub
parent 42776c0949
commit adaa463ee3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1 @@
Ignore ``.py`` files created by ``pyproject.toml``-based editable builds introduced in `pip 21.3 <https://pip.pypa.io/en/stable/news/#v21-3>`__.

View File

@ -836,7 +836,8 @@ def _iter_rewritable_modules(package_files: Iterable[str]) -> Iterator[str]:
if is_simple_module:
module_name, _ = os.path.splitext(fn)
# we ignore "setup.py" at the root of the distribution
if module_name != "setup":
# as well as editable installation finder modules made by setuptools
if module_name != "setup" and not module_name.startswith("__editable__"):
seen_some = True
yield module_name
elif is_package:

View File

@ -842,6 +842,9 @@ class TestConfigAPI:
(["src/bar/__init__.py"], ["bar"]),
(["src/bar/__init__.py", "setup.py"], ["bar"]),
(["source/python/bar/__init__.py", "setup.py"], ["bar"]),
# editable installation finder modules
(["__editable___xyz_finder.py"], []),
(["bar/__init__.py", "__editable___xyz_finder.py"], ["bar"]),
],
)
def test_iter_rewritable_modules(self, names, expected) -> None: