Installs the LegacyTmpdirPlugin if the ``tmpdir`` plugin is also installed.
(config: Config)
| 437 | |
| 438 | @hookimpl |
| 439 | def pytest_configure(config: Config) -> None: |
| 440 | """Installs the LegacyTmpdirPlugin if the ``tmpdir`` plugin is also installed.""" |
| 441 | if config.pluginmanager.has_plugin("tmpdir"): |
| 442 | mp = MonkeyPatch() |
| 443 | config.add_cleanup(mp.undo) |
| 444 | # Create TmpdirFactory and attach it to the config object. |
| 445 | # |
| 446 | # This is to comply with existing plugins which expect the handler to be |
| 447 | # available at pytest_configure time, but ideally should be moved entirely |
| 448 | # to the tmpdir_factory session fixture. |
| 449 | try: |
| 450 | tmp_path_factory = config._tmp_path_factory # type: ignore[attr-defined] |
| 451 | except AttributeError: |
| 452 | # tmpdir plugin is blocked. |
| 453 | pass |
| 454 | else: |
| 455 | _tmpdirhandler = TempdirFactory(tmp_path_factory, _ispytest=True) |
| 456 | mp.setattr(config, "_tmpdirhandler", _tmpdirhandler, raising=False) |
| 457 | |
| 458 | config.pluginmanager.register(LegacyTmpdirPlugin, "legacypath-tmpdir") |
| 459 | |
| 460 | |
| 461 | @hookimpl |
nothing calls this directly
no test coverage detected