Run pytest as a subprocess with given arguments. Any plugins added to the :py:attr:`plugins` list will be added using the ``-p`` command line option. Additionally ``--basetemp`` is used to put any temporary files and directories in a numbered directory prefixed with
(
self, *args: Union[str, "os.PathLike[str]"], timeout: Optional[float] = None
)
| 1446 | return self.run(sys.executable, "-c", command) |
| 1447 | |
| 1448 | def runpytest_subprocess( |
| 1449 | self, *args: Union[str, "os.PathLike[str]"], timeout: Optional[float] = None |
| 1450 | ) -> RunResult: |
| 1451 | """Run pytest as a subprocess with given arguments. |
| 1452 | |
| 1453 | Any plugins added to the :py:attr:`plugins` list will be added using the |
| 1454 | ``-p`` command line option. Additionally ``--basetemp`` is used to put |
| 1455 | any temporary files and directories in a numbered directory prefixed |
| 1456 | with "runpytest-" to not conflict with the normal numbered pytest |
| 1457 | location for temporary files and directories. |
| 1458 | |
| 1459 | :param args: |
| 1460 | The sequence of arguments to pass to the pytest subprocess. |
| 1461 | :param timeout: |
| 1462 | The period in seconds after which to timeout and raise |
| 1463 | :py:class:`Pytester.TimeoutExpired`. |
| 1464 | """ |
| 1465 | __tracebackhide__ = True |
| 1466 | p = make_numbered_dir(root=self.path, prefix="runpytest-", mode=0o700) |
| 1467 | args = ("--basetemp=%s" % p,) + args |
| 1468 | plugins = [x for x in self.plugins if isinstance(x, str)] |
| 1469 | if plugins: |
| 1470 | args = ("-p", plugins[0]) + args |
| 1471 | args = self._getpytestargs() + args |
| 1472 | return self.run(*args, timeout=timeout) |
| 1473 | |
| 1474 | def spawn_pytest( |
| 1475 | self, string: str, expect_timeout: float = 10.0 |
no test coverage detected