Add warning when testpaths is set but paths are not found by glob (#11044)

Closes #11013

---------

Co-authored-by: Ran Benita <ran@unusedvar.com>
This commit is contained in:
Kenny Y
2023-05-30 06:06:13 -04:00
committed by GitHub
parent fbfd4b5005
commit 7c231baa64
4 changed files with 25 additions and 0 deletions

View File

@@ -777,6 +777,20 @@ class TestStackLevel:
)
def test_warning_on_testpaths_not_found(pytester: Pytester) -> None:
# Check for warning when testpaths set, but not found by glob
pytester.makeini(
"""
[pytest]
testpaths = absent
"""
)
result = pytester.runpytest()
result.stdout.fnmatch_lines(
["*ConfigWarning: No files were found in testpaths*", "*1 warning*"]
)
def test_resource_warning(pytester: Pytester, monkeypatch: pytest.MonkeyPatch) -> None:
# Some platforms (notably PyPy) don't have tracemalloc.
# We choose to explicitly not skip this in case tracemalloc is not