Skip to content

Commit 3694415

Browse files
committed
pytester: typing for spawn/spawn_pytest
1 parent 4806878 commit 3694415

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/_pytest/pytester.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
if TYPE_CHECKING:
4040
from typing import Type
4141

42+
import pexpect
43+
4244

4345
IGNORE_PAM = [ # filenames added when obtaining details about the current user
4446
"/var/lib/sss/mc/passwd"
@@ -1240,7 +1242,9 @@ def runpytest_subprocess(self, *args, timeout=None) -> RunResult:
12401242
args = self._getpytestargs() + args
12411243
return self.run(*args, timeout=timeout)
12421244

1243-
def spawn_pytest(self, string, expect_timeout=10.0):
1245+
def spawn_pytest(
1246+
self, string: str, expect_timeout: float = 10.0
1247+
) -> "pexpect.spawn":
12441248
"""Run pytest using pexpect.
12451249
12461250
This makes sure to use the right pytest and sets up the temporary
@@ -1254,7 +1258,7 @@ def spawn_pytest(self, string, expect_timeout=10.0):
12541258
cmd = "{} --basetemp={} {}".format(invoke, basetemp, string)
12551259
return self.spawn(cmd, expect_timeout=expect_timeout)
12561260

1257-
def spawn(self, cmd, expect_timeout=10.0):
1261+
def spawn(self, cmd: str, expect_timeout: float = 10.0) -> "pexpect.spawn":
12581262
"""Run a command using pexpect.
12591263
12601264
The pexpect child is returned.

0 commit comments

Comments
 (0)