|
10 | 10 | from collections.abc import Generator |
11 | 11 | from collections.abc import Iterable |
12 | 12 | from collections.abc import Iterator |
| 13 | +from collections.abc import Mapping |
13 | 14 | from collections.abc import Sequence |
14 | 15 | import contextlib |
15 | 16 | import copy |
@@ -290,23 +291,21 @@ def directory_arg(path: str, optname: str) -> str: |
290 | 291 |
|
291 | 292 |
|
292 | 293 | def get_config( |
293 | | - args: list[str] | None = None, |
| 294 | + args: Iterable[str] | None = None, |
294 | 295 | plugins: Sequence[str | _PluggyPlugin] | None = None, |
295 | 296 | ) -> Config: |
296 | 297 | # Subsequent calls to main will create a fresh instance. |
297 | 298 | pluginmanager = PytestPluginManager() |
298 | | - config = Config( |
299 | | - pluginmanager, |
300 | | - invocation_params=Config.InvocationParams( |
301 | | - args=args or (), |
302 | | - plugins=plugins, |
303 | | - dir=pathlib.Path.cwd(), |
304 | | - ), |
| 299 | + invocation_params = Config.InvocationParams( |
| 300 | + args=args or (), |
| 301 | + plugins=plugins, |
| 302 | + dir=pathlib.Path.cwd(), |
305 | 303 | ) |
| 304 | + config = Config(pluginmanager, invocation_params=invocation_params) |
306 | 305 |
|
307 | | - if args is not None: |
| 306 | + if invocation_params.args: |
308 | 307 | # Handle any "-p no:plugin" args. |
309 | | - pluginmanager.consider_preparse(args, exclude_only=True) |
| 308 | + pluginmanager.consider_preparse(invocation_params.args, exclude_only=True) |
310 | 309 |
|
311 | 310 | for spec in default_plugins: |
312 | 311 | pluginmanager.import_plugin(spec) |
@@ -1202,7 +1201,7 @@ def cwd_relative_nodeid(self, nodeid: str) -> str: |
1202 | 1201 | return nodeid |
1203 | 1202 |
|
1204 | 1203 | @classmethod |
1205 | | - def fromdictargs(cls, option_dict, args) -> Config: |
| 1204 | + def fromdictargs(cls, option_dict: Mapping[str, Any], args: list[str]) -> Config: |
1206 | 1205 | """Constructor usable for subprocesses.""" |
1207 | 1206 | config = get_config(args) |
1208 | 1207 | config.option.__dict__.update(option_dict) |
|
0 commit comments