From 36944157f82887180538cd6cba795440724fb180 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 10 Jan 2020 15:19:26 +0100 Subject: [PATCH] pytester: typing for `spawn`/`spawn_pytest` --- src/_pytest/pytester.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index d35ef3d7c..c1aa34bcf 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -39,6 +39,8 @@ from _pytest.reports import TestReport if TYPE_CHECKING: from typing import Type + import pexpect + IGNORE_PAM = [ # filenames added when obtaining details about the current user "/var/lib/sss/mc/passwd" @@ -1240,7 +1242,9 @@ class Testdir: args = self._getpytestargs() + args return self.run(*args, timeout=timeout) - def spawn_pytest(self, string, expect_timeout=10.0): + def spawn_pytest( + self, string: str, expect_timeout: float = 10.0 + ) -> "pexpect.spawn": """Run pytest using pexpect. This makes sure to use the right pytest and sets up the temporary @@ -1254,7 +1258,7 @@ class Testdir: cmd = "{} --basetemp={} {}".format(invoke, basetemp, string) return self.spawn(cmd, expect_timeout=expect_timeout) - def spawn(self, cmd, expect_timeout=10.0): + def spawn(self, cmd: str, expect_timeout: float = 10.0) -> "pexpect.spawn": """Run a command using pexpect. The pexpect child is returned.