Skip to content

Commit 9d26f1f

Browse files
committed
Bail if no setup.cfg present
1 parent 7fd3777 commit 9d26f1f

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/_pytest/main.py

+11-9
Original file line numberDiff line numberDiff line change
@@ -393,16 +393,18 @@ def _in_build(path: Path) -> bool:
393393
if not path.is_dir():
394394
return False
395395

396+
setup_cfg = path.parent / "setup.cfg"
397+
if not setup_cfg.is_file():
398+
return False
399+
396400
if any(fnmatch_ex(pat, path) for pat in ("build", "dist")):
397-
setup_cfg = path.parent / "setup.cfg"
398-
if (setup_cfg).is_file():
399-
setup_py = path.parent / "setup.py"
400-
if setup_py.is_file():
401-
return True
402-
403-
toml = path.parent / "pyproject.toml"
404-
if toml.is_file() and _is_setuptools_in_pyproject_toml(toml):
405-
return True
401+
setup_py = path.parent / "setup.py"
402+
if setup_py.is_file():
403+
return True
404+
405+
toml = path.parent / "pyproject.toml"
406+
if toml.is_file() and _is_setuptools_in_pyproject_toml(toml):
407+
return True
406408

407409
return False
408410

0 commit comments

Comments
 (0)