MCPcopy Create free account
hub / github.com/pytest-dev/pytest / spawn

Method spawn

src/_pytest/pytester.py:1490–1504  ·  view source on GitHub ↗

Run a command using pexpect. The pexpect child is returned.

(self, cmd: str, expect_timeout: float = 10.0)

Source from the content-addressed store, hash-verified

1488 return self.spawn(cmd, expect_timeout=expect_timeout)
1489
1490 def spawn(self, cmd: str, expect_timeout: float = 10.0) -> "pexpect.spawn":
1491 """Run a command using pexpect.
1492
1493 The pexpect child is returned.
1494 """
1495 pexpect = importorskip("pexpect", "3.0")
1496 if hasattr(sys, "pypy_version_info") and "64" in platform.machine():
1497 skip("pypy-64 bit not supported")
1498 if not hasattr(pexpect, "spawn"):
1499 skip("pexpect.spawn not available")
1500 logfile = self.path.joinpath("spawn.out").open("wb")
1501
1502 child = pexpect.spawn(cmd, logfile=logfile, timeout=expect_timeout)
1503 self._request.addfinalizer(logfile.close)
1504 return child
1505
1506
1507class LineComp:

Callers 2

spawn_pytestMethod · 0.95

Calls 3

importorskipFunction · 0.90
skipFunction · 0.90
addfinalizerMethod · 0.45

Tested by

no test coverage detected