Skip to content

Commit ee7e1c9

Browse files
Remove redundant if, tidy if-body
1 parent de9d116 commit ee7e1c9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

_pytest/fixtures.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,11 +1145,10 @@ def _splitnode(cls, nodeid):
11451145
return []
11461146
sep = py.path.local.sep
11471147
parts = nodeid.split(sep)
1148-
if parts:
1149-
last_part = parts[-1]
1150-
if '::' in last_part:
1151-
namespace_parts = last_part.split("::")
1152-
parts[-1:] = namespace_parts
1148+
last_part = parts[-1]
1149+
if '::' in last_part:
1150+
# Replace single last element 'test_foo.py::Bar::()' with multiple elements 'test_foo.py', 'Bar', '()'
1151+
parts[-1:] = last_part.split("::")
11531152
return parts
11541153

11551154
@classmethod

0 commit comments

Comments
 (0)