Pytester.makepyfile and Pytester.maketxtfile are declared as def makepyfile(self, *args, **kwargs) -> Path, with no annotations on the params. Pyright strict (and basedpyright default) report reportUnknownMemberType at every call site. The sibling makefile is annotated as *args: str, **kwargs: str and is fine.
Minimal repro:
# repro.py
from pytest import Pytester
def test_x(pytester: Pytester) -> None:
pytester.makepyfile("def test_inner() -> None: pass")
// pyrightconfig.json
{ "typeCheckingMode": "strict" }
$ pyright repro.py # pytest==9.0.3, pyright==1.1.408
repro.py:4:5 - error: Type of "makepyfile" is partially unknown
Type of "makepyfile" is "(...) -> Path" (reportUnknownMemberType)
Proposed fix: annotate both methods as *args: str, **kwargs: str to match makefile. #14080 already implements this; opening this issue to give it user-facing motivation.
Pytester.makepyfileandPytester.maketxtfileare declared asdef makepyfile(self, *args, **kwargs) -> Path, with no annotations on the params. Pyright strict (and basedpyright default) reportreportUnknownMemberTypeat every call site. The siblingmakefileis annotated as*args: str, **kwargs: strand is fine.Minimal repro:
Proposed fix: annotate both methods as
*args: str, **kwargs: strto matchmakefile. #14080 already implements this; opening this issue to give it user-facing motivation.