From d835a8a1e8962f84504a891a75e6bbd33a7b8401 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 30 Apr 2024 05:21:31 -0400 Subject: [PATCH] Leverage sort for sorting items. (#5378) --- xonsh/pytest/plugin.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/xonsh/pytest/plugin.py b/xonsh/pytest/plugin.py index 9cb7af67c..08aff1798 100644 --- a/xonsh/pytest/plugin.py +++ b/xonsh/pytest/plugin.py @@ -34,14 +34,7 @@ def pytest_collection_modifyitems(items): """Move xsh test first to work around a bug in normal pytest cleanup. The order of tests are otherwise preserved. """ - xsh_items = [] - other_items = [] - for item in items: - if isinstance(item, XshFunction): - xsh_items.append(item) - else: - other_items.append(item) - items[:] = xsh_items + other_items + items.sort(key=lambda item: -isinstance(item, XshFunction)) def _limited_traceback(excinfo):