summaryrefslogtreecommitdiff
path: root/src/_pytest/nodes.py
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2020-04-30 16:08:24 +0300
committerRan Benita <ran@unusedvar.com>2020-05-06 11:58:30 +0300
commitb90f34569f39106c3a62a6b6087e9f0d70508190 (patch)
tree079cfbd998846150593517beb7f39223e5fe5cd5 /src/_pytest/nodes.py
parent5702c86f4c8e2d79c1bf1ba6ff40e8879f8903c8 (diff)
downloadpytest-b90f34569f39106c3a62a6b6087e9f0d70508190.tar.gz
nodes: micro-optimize Node attribute access
Diffstat (limited to 'src/_pytest/nodes.py')
-rw-r--r--src/_pytest/nodes.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/_pytest/nodes.py b/src/_pytest/nodes.py
index 0a1f89c74..56c1d4404 100644
--- a/src/_pytest/nodes.py
+++ b/src/_pytest/nodes.py
@@ -91,6 +91,19 @@ class Node(metaclass=NodeMeta):
""" base class for Collector and Item the test collection tree.
Collector subclasses have children, Items are terminal nodes."""
+ # Use __slots__ to make attribute access faster.
+ # Note that __dict__ is still available.
+ __slots__ = (
+ "name",
+ "parent",
+ "config",
+ "session",
+ "fspath",
+ "_nodeid",
+ "_store",
+ "__dict__",
+ )
+
def __init__(
self,
name: str,