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

Method spawn_pytest

src/_pytest/pytester.py:1523–1535  ·  src/_pytest/pytester.py::Pytester.spawn_pytest

Run pytest using pexpect. This makes sure to use the right pytest and sets up the temporary directory locations. The pexpect child is returned.

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

Source from the content-addressed store, hash-verified

1521 return self.run(*args, timeout=timeout)
1522
1523 def spawn_pytest(self, string: str, expect_timeout: float = 10.0) -> pexpect.spawn:
1524 class="st">"""Run pytest using pexpect.
1525
1526 This makes sure to use the right pytest and sets up the temporary
1527 directory locations.
1528
1529 The pexpect child is returned.
1530 class="st">"""
1531 basetemp = self.path / class="st">"temp-pexpect"
1532 basetemp.mkdir(mode=0o700)
1533 invoke = class="st">" ".join(map(str, self._getpytestargs()))
1534 cmd = fclass="st">"{invoke} --basetemp={basetemp} {string}"
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.

Calls 4

_getpytestargsMethod · 0.95
spawnMethod · 0.95
joinMethod · 0.80
mkdirMethod · 0.45

Tested by

no test coverage detected