Skip to content

Commit adaa463

Browse files
Ignore editable installation modules (#10231)
Fixes #10230
1 parent 42776c0 commit adaa463

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

changelog/10230.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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>`__.

src/_pytest/config/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,8 @@ def _iter_rewritable_modules(package_files: Iterable[str]) -> Iterator[str]:
836836
if is_simple_module:
837837
module_name, _ = os.path.splitext(fn)
838838
# we ignore "setup.py" at the root of the distribution
839-
if module_name != "setup":
839+
# as well as editable installation finder modules made by setuptools
840+
if module_name != "setup" and not module_name.startswith("__editable__"):
840841
seen_some = True
841842
yield module_name
842843
elif is_package:

testing/test_config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,9 @@ def test_confcutdir_check_isdir(self, pytester: Pytester) -> None:
842842
(["src/bar/__init__.py"], ["bar"]),
843843
(["src/bar/__init__.py", "setup.py"], ["bar"]),
844844
(["source/python/bar/__init__.py", "setup.py"], ["bar"]),
845+
# editable installation finder modules
846+
(["__editable___xyz_finder.py"], []),
847+
(["bar/__init__.py", "__editable___xyz_finder.py"], ["bar"]),
845848
],
846849
)
847850
def test_iter_rewritable_modules(self, names, expected) -> None:

0 commit comments

Comments
 (0)