@@ -27,7 +27,7 @@ def _splitnode(nodeid):
2727 ''
2828 'testing/code'
2929 'testing/code/test_excinfo.py'
30- 'testing/code/test_excinfo.py::TestFormattedExcinfo::() '
30+ 'testing/code/test_excinfo.py::TestFormattedExcinfo'
3131
3232 Return values are lists e.g.
3333 []
@@ -39,15 +39,15 @@ def _splitnode(nodeid):
3939 # If there is no root node at all, return an empty list so the caller's logic can remain sane
4040 return []
4141 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'
4343 parts [- 1 :] = parts [- 1 ].split ("::" )
4444 return parts
4545
4646
4747def ischildnode (baseid , nodeid ):
4848 """Return True if the nodeid is a child node of the baseid.
4949
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'
5151 """
5252 base_parts = _splitnode (baseid )
5353 node_parts = _splitnode (nodeid )
@@ -107,10 +107,12 @@ def __init__(
107107 self ._name2pseudofixturedef = {}
108108
109109 if nodeid is not None :
110+ assert "::()" not in nodeid
110111 self ._nodeid = nodeid
111112 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
114116
115117 @property
116118 def ihook (self ):
0 commit comments