summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2020-12-26 19:54:07 +0200
committerRan Benita <ran@unusedvar.com>2020-12-26 19:54:07 +0200
commit6d3a66d947a57fed99dcb4bae47062cd9ce6a5f2 (patch)
treef0354427f201f30f460b2b4458349b1ed08b6257
parentd8d2df7e6f38e5c3681528bc1a998c904d49e5cc (diff)
downloadpytest-6d3a66d947a57fed99dcb4bae47062cd9ce6a5f2.tar.gz
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.
-rw-r--r--src/_pytest/nodes.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/_pytest/nodes.py b/src/_pytest/nodes.py
index da2a0a7ea..c6eb49dec 100644
--- a/src/_pytest/nodes.py
+++ b/src/_pytest/nodes.py
@@ -1,10 +1,12 @@
import os
import warnings
from pathlib import Path
+from typing import Any
from typing import Callable
from typing import Iterable
from typing import Iterator
from typing import List
+from typing import MutableMapping
from typing import Optional
from typing import overload
from typing import Set
@@ -148,8 +150,9 @@ class Node(metaclass=NodeMeta):
#: Filesystem path where this node was collected from (can be None).
self.fspath = fspath or getattr(parent, "fspath", None)
+ # The explicit annotation is to avoid publicly exposing NodeKeywords.
#: Keywords/markers collected from all scopes.
- self.keywords = NodeKeywords(self)
+ self.keywords: MutableMapping[str, Any] = NodeKeywords(self)
#: The marker objects belonging to this node.
self.own_markers: List[Mark] = []