@@ -27,7 +27,7 @@ def _splitnode(nodeid):
27
27
''
28
28
'testing/code'
29
29
'testing/code/test_excinfo.py'
30
- 'testing/code/test_excinfo.py::TestFormattedExcinfo::() '
30
+ 'testing/code/test_excinfo.py::TestFormattedExcinfo'
31
31
32
32
Return values are lists e.g.
33
33
[]
@@ -39,15 +39,15 @@ def _splitnode(nodeid):
39
39
# If there is no root node at all, return an empty list so the caller's logic can remain sane
40
40
return []
41
41
parts = nodeid .split (SEP )
42
- # Replace single last element 'test_foo.py::Bar::() ' with multiple elements 'test_foo.py', 'Bar', '() '
42
+ # Replace single last element 'test_foo.py::Bar' with multiple elements 'test_foo.py', 'Bar'
43
43
parts [- 1 :] = parts [- 1 ].split ("::" )
44
44
return parts
45
45
46
46
47
47
def ischildnode (baseid , nodeid ):
48
48
"""Return True if the nodeid is a child node of the baseid.
49
49
50
- E.g. 'foo/bar::Baz::() ' is a child of 'foo', 'foo/bar' and 'foo/bar::Baz', but not of 'foo/blorp'
50
+ E.g. 'foo/bar::Baz' is a child of 'foo', 'foo/bar' and 'foo/bar::Baz', but not of 'foo/blorp'
51
51
"""
52
52
base_parts = _splitnode (baseid )
53
53
node_parts = _splitnode (nodeid )
@@ -107,10 +107,12 @@ def __init__(
107
107
self ._name2pseudofixturedef = {}
108
108
109
109
if nodeid is not None :
110
+ assert "::()" not in nodeid
110
111
self ._nodeid = nodeid
111
112
else :
112
- assert parent is not None
113
- self ._nodeid = self .parent .nodeid + "::" + self .name
113
+ self ._nodeid = self .parent .nodeid
114
+ if self .name != "()" :
115
+ self ._nodeid += "::" + self .name
114
116
115
117
@property
116
118
def ihook (self ):
0 commit comments