(
self,
request: FixtureRequest,
tmp_path_factory: TempPathFactory,
monkeypatch: MonkeyPatch,
*,
_ispytest: bool = False,
)
| 667 | pass |
| 668 | |
| 669 | def __init__( |
| 670 | self, |
| 671 | request: FixtureRequest, |
| 672 | tmp_path_factory: TempPathFactory, |
| 673 | monkeypatch: MonkeyPatch, |
| 674 | *, |
| 675 | _ispytest: bool = False, |
| 676 | ) -> None: |
| 677 | check_ispytest(_ispytest) |
| 678 | self._request = request |
| 679 | self._mod_collections: WeakKeyDictionary[Collector, list[Item | Collector]] = ( |
| 680 | WeakKeyDictionary() |
| 681 | ) |
| 682 | if request.function: |
| 683 | name: str = request.function.__name__ |
| 684 | else: |
| 685 | name = request.node.name |
| 686 | self._name = name |
| 687 | self._path: Path = tmp_path_factory.mktemp(name, numbered=True) |
| 688 | #: A list of plugins to use with :py:meth:`parseconfig` and |
| 689 | #: :py:meth:`runpytest`. Initially this is an empty list but plugins can |
| 690 | #: be added to the list. |
| 691 | #: |
| 692 | #: When running in subprocess mode, specify plugins by name (str) - adding |
| 693 | #: plugin objects directly is not supported. |
| 694 | self.plugins: list[str | _PluggyPlugin] = [] |
| 695 | self._sys_path_snapshot = SysPathsSnapshot() |
| 696 | self._sys_modules_snapshot = self.__take_sys_modules_snapshot() |
| 697 | self._request.addfinalizer(self._finalize) |
| 698 | self._method = self._request.config.getoption("--runpytest") |
| 699 | self._test_tmproot = tmp_path_factory.mktemp(f"tmp-{name}", numbered=True) |
| 700 | |
| 701 | self._monkeypatch = mp = monkeypatch |
| 702 | self.chdir() |
| 703 | mp.setenv("PYTEST_DEBUG_TEMPROOT", str(self._test_tmproot)) |
| 704 | # Ensure no unexpected caching via tox. |
| 705 | mp.delenv("TOX_ENV_DIR", raising=False) |
| 706 | # Discard outer pytest options. |
| 707 | mp.delenv("PYTEST_ADDOPTS", raising=False) |
| 708 | # Ensure no user config is used. |
| 709 | tmphome = str(self.path) |
| 710 | mp.setenv("HOME", tmphome) |
| 711 | mp.setenv("USERPROFILE", tmphome) |
| 712 | # Do not use colors for inner runs by default. |
| 713 | mp.setenv("PY_COLORS", "0") |
| 714 | |
| 715 | @property |
| 716 | def path(self) -> Path: |
nothing calls this directly
no test coverage detected