Add warning when testpaths is set but paths are not found by glob
This commit is contained in:
parent
4f3f36c396
commit
14d1d950cd
|
@ -0,0 +1 @@
|
||||||
|
Added warning when testpaths is set, but paths are not found by glob. In this case, pytest will search fall back to searching from current directory.
|
|
@ -1382,6 +1382,14 @@ class Config:
|
||||||
args = []
|
args = []
|
||||||
for path in testpaths:
|
for path in testpaths:
|
||||||
args.extend(sorted(glob.iglob(path, recursive=True)))
|
args.extend(sorted(glob.iglob(path, recursive=True)))
|
||||||
|
if testpaths and not args:
|
||||||
|
warning_text = (
|
||||||
|
"testpaths defined but path not found, "
|
||||||
|
"will search recursively from current directory instead"
|
||||||
|
)
|
||||||
|
self.issue_config_time_warning(
|
||||||
|
PytestConfigWarning(warning_text), stacklevel=3
|
||||||
|
)
|
||||||
if not args:
|
if not args:
|
||||||
source = Config.ArgsSource.INCOVATION_DIR
|
source = Config.ArgsSource.INCOVATION_DIR
|
||||||
args = [str(self.invocation_params.dir)]
|
args = [str(self.invocation_params.dir)]
|
||||||
|
|
Loading…
Reference in New Issue