| 1102 | cache: Cache |
| 1103 | |
| 1104 | def __init__( |
| 1105 | self, |
| 1106 | pluginmanager: PytestPluginManager, |
| 1107 | *, |
| 1108 | invocation_params: InvocationParams | None = None, |
| 1109 | prog: str | None = None, |
| 1110 | ) -> None: |
| 1111 | if invocation_params is None: |
| 1112 | invocation_params = self.InvocationParams( |
| 1113 | args=(), plugins=None, dir=pathlib.Path.cwd() |
| 1114 | ) |
| 1115 | |
| 1116 | self.option = argparse.Namespace() |
| 1117 | """Access to command line option as attributes. |
| 1118 | |
| 1119 | :type: argparse.Namespace |
| 1120 | """ |
| 1121 | |
| 1122 | self.invocation_params = invocation_params |
| 1123 | """The parameters with which pytest was invoked. |
| 1124 | |
| 1125 | :type: InvocationParams |
| 1126 | """ |
| 1127 | |
| 1128 | self._parser = Parser( |
| 1129 | usage=f"%(prog)s [options] [{FILE_OR_DIR}] [{FILE_OR_DIR}] [...]", |
| 1130 | processopt=self._processopt, |
| 1131 | prog=prog, |
| 1132 | _ispytest=True, |
| 1133 | ) |
| 1134 | self.pluginmanager = pluginmanager |
| 1135 | """The plugin manager handles plugin registration and hook invocation. |
| 1136 | |
| 1137 | :type: PytestPluginManager |
| 1138 | """ |
| 1139 | |
| 1140 | self.stash = Stash() |
| 1141 | """A place where plugins can store information on the config for their |
| 1142 | own use. |
| 1143 | |
| 1144 | :type: Stash |
| 1145 | """ |
| 1146 | # Deprecated alias. Was never public. Can be removed in a few releases. |
| 1147 | self._store = self.stash |
| 1148 | |
| 1149 | self.trace = self.pluginmanager.trace.root.get("config") |
| 1150 | self.hook = self.pluginmanager.hook |
| 1151 | self._inicache: dict[str, Any] = {} |
| 1152 | self._inicfg: ConfigDict = {} |
| 1153 | self._cleanup_stack = contextlib.ExitStack() |
| 1154 | self.pluginmanager.register(self, "pytestconfig") |
| 1155 | self._configured = False |
| 1156 | self.hook.pytest_addoption.call_historic( |
| 1157 | kwargs=dict(parser=self._parser, pluginmanager=self.pluginmanager) |
| 1158 | ) |
| 1159 | self.args_source = Config.ArgsSource.ARGS |
| 1160 | self.args: list[str] = [] |
| 1161 | |