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

Method spawn

src/_pytest/pytester.py:1537–1551  ·  src/_pytest/pytester.py::Pytester.spawn

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 class="st">"""Run a command using pexpect.
1539
1540 The pexpect child is returned.
1541 class="st">"""
1542 pexpect = importorskip(class="st">"pexpect", class="st">"3.0")
1543 if hasattr(sys, class="st">"pypy_version_info") and class="st">"64" in platform.machine():
1544 skip(class="st">"pypy-64 bit not supported")
1545 if not hasattr(pexpect, class="st">"spawn"):
1546 skip(class="st">"pexpect.spawn not available")
1547 logfile = self.path.joinpath(class="st">"spawn.out").open(class="st">"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