diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index f8b1c19459f..37a6e43927a 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -405,8 +405,14 @@ def reorder_items_atscope( else: slicing_argkey, _ = argkeys.popitem() # deque because they'll just be ignored. - unique_matching_items = dict.fromkeys(scoped_items_by_argkey[slicing_argkey]) - for i in reversed(unique_matching_items if sys.version_info.minor > 7 else list(unique_matching_items)): + unique_matching_items = dict.fromkeys( + scoped_items_by_argkey[slicing_argkey] + ) + for i in reversed( + unique_matching_items + if sys.version_info.minor > 7 + else list(unique_matching_items) + ): if i not in items: continue fix_cache_order(i, argkeys_cache, items_by_argkey, ignore, scope)