MCPcopy
hub / github.com/pytest-dev/pytest / spawn

Method spawn

src/_pytest/pytester.py:1537–1551  ·  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

1535 return self.spawn(cmd, expect_timeout=expect_timeout)
1536
1537 def spawn(self, cmd: str, expect_timeout: float = 10.0) -> pexpect.spawn:
1538 """Run a command using pexpect.
1539
1540 The pexpect child is returned.
1541 """
1542 pexpect = importorskip("pexpect", "3.0")
1543 if hasattr(sys, "pypy_version_info") and "64" in platform.machine():
1544 skip("pypy-64 bit not supported")
1545 if not hasattr(pexpect, "spawn"):
1546 skip("pexpect.spawn not available")
1547 logfile = self.path.joinpath("spawn.out").open("wb")
1548
1549 child = pexpect.spawn(cmd, logfile=logfile, timeout=expect_timeout)
1550 self._request.addfinalizer(logfile.close)
1551 return child
1552
1553
1554class LineComp:

Callers 2

spawn_pytestMethod · 0.95

Calls 3

importorskipFunction · 0.90
openMethod · 0.80
addfinalizerMethod · 0.45

Tested by

no test coverage detected