Skip to content

Commit b5c0b85

Browse files
committed
config: fix a type error in pyright due to different narrowing rules
For some reason pyright infers the type of `essential_plugins` and `default_plugins` as `tuple[Literal[...], ...]` even if they are explicitly annotated as `tuple[str, ...]`. This then causes an error in the `builtin_plugins.add` calls. Replace with one-shot initialization appeases pyright and is nicer regardless.
1 parent 0e734c7 commit b5c0b85

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/_pytest/config/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,11 @@ def directory_arg(path: str, optname: str) -> str:
273273
"faulthandler",
274274
)
275275

276-
builtin_plugins = set(default_plugins)
277-
builtin_plugins.add("pytester")
278-
builtin_plugins.add("pytester_assertions")
276+
builtin_plugins = {
277+
*default_plugins,
278+
"pytester",
279+
"pytester_assertions",
280+
}
279281

280282

281283
def get_config(

0 commit comments

Comments
 (0)