Skip to content

Commit 6d3a66d

Browse files
committed
nodes: avoid needing to expose NodeKeywords for typing
It adds no value over exporting just the ABC so do that to reduce the API surface.
1 parent d8d2df7 commit 6d3a66d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/_pytest/nodes.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import os
22
import warnings
33
from pathlib import Path
4+
from typing import Any
45
from typing import Callable
56
from typing import Iterable
67
from typing import Iterator
78
from typing import List
9+
from typing import MutableMapping
810
from typing import Optional
911
from typing import overload
1012
from typing import Set
@@ -148,8 +150,9 @@ def __init__(
148150
#: Filesystem path where this node was collected from (can be None).
149151
self.fspath = fspath or getattr(parent, "fspath", None)
150152

153+
# The explicit annotation is to avoid publicly exposing NodeKeywords.
151154
#: Keywords/markers collected from all scopes.
152-
self.keywords = NodeKeywords(self)
155+
self.keywords: MutableMapping[str, Any] = NodeKeywords(self)
153156

154157
#: The marker objects belonging to this node.
155158
self.own_markers: List[Mark] = []

0 commit comments

Comments
 (0)