From ee7e1c94d2436e82ad4e455f0cc436ddacae44e3 Mon Sep 17 00:00:00 2001 From: Tom Dalton Date: Mon, 23 Oct 2017 16:12:07 +0100 Subject: [PATCH] Remove redundant if, tidy if-body --- _pytest/fixtures.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/_pytest/fixtures.py b/_pytest/fixtures.py index 51ccaed67..f69326f1d 100644 --- a/_pytest/fixtures.py +++ b/_pytest/fixtures.py @@ -1145,11 +1145,10 @@ class FixtureManager: return [] sep = py.path.local.sep parts = nodeid.split(sep) - if parts: - last_part = parts[-1] - if '::' in last_part: - namespace_parts = last_part.split("::") - parts[-1:] = namespace_parts + last_part = parts[-1] + if '::' in last_part: + # Replace single last element 'test_foo.py::Bar::()' with multiple elements 'test_foo.py', 'Bar', '()' + parts[-1:] = last_part.split("::") return parts @classmethod