Skip to content

Commit 44d31b6

Browse files
committed
Bail if no setup.cfg present
1 parent 961bb42 commit 44d31b6

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/_pytest/main.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -399,16 +399,18 @@ def _in_build(path: Path) -> bool:
399399
if not path.is_dir():
400400
return False
401401

402+
setup_cfg = path.parent / "setup.cfg"
403+
if not setup_cfg.is_file():
404+
return False
405+
402406
if any(fnmatch_ex(pat, path) for pat in ("build", "dist")):
403-
setup_cfg = path.parent / "setup.cfg"
404-
if (setup_cfg).is_file():
405-
setup_py = path.parent / "setup.py"
406-
if setup_py.is_file():
407-
return True
408-
409-
toml = path.parent / "pyproject.toml"
410-
if toml.is_file() and _is_setuptools_in_pyproject_toml(toml):
411-
return True
407+
setup_py = path.parent / "setup.py"
408+
if setup_py.is_file():
409+
return True
410+
411+
toml = path.parent / "pyproject.toml"
412+
if toml.is_file() and _is_setuptools_in_pyproject_toml(toml):
413+
return True
412414

413415
return False
414416

0 commit comments

Comments
 (0)