Skip to content

Commit 71b79fc

Browse files
GergelyKalmarpytestbot
authored andcommitted
[7.1.x] Ignore editable installation modules
1 parent 89f7518 commit 71b79fc

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

changelog/10230.bugfix.rst

+1
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

+2-1
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,8 @@ def _iter_rewritable_modules(package_files: Iterable[str]) -> Iterator[str]:
833833
if is_simple_module:
834834
module_name, _ = os.path.splitext(fn)
835835
# we ignore "setup.py" at the root of the distribution
836-
if module_name != "setup":
836+
# as well as editable installation finder modules made by setuptools
837+
if module_name != "setup" and not module_name.startswith("__editable__"):
837838
seen_some = True
838839
yield module_name
839840
elif is_package:

testing/test_config.py

+3
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,9 @@ def test_confcutdir_check_isdir(self, pytester: Pytester) -> None:
837837
(["src/bar/__init__.py"], ["bar"]),
838838
(["src/bar/__init__.py", "setup.py"], ["bar"]),
839839
(["source/python/bar/__init__.py", "setup.py"], ["bar"]),
840+
# editable installation finder modules
841+
(["__editable___xyz_finder.py"], []),
842+
(["bar/__init__.py", "__editable___xyz_finder.py"], ["bar"]),
840843
],
841844
)
842845
def test_iter_rewritable_modules(self, names, expected) -> None:

0 commit comments

Comments
 (0)