From 96e3b0194c540ba6c7bfcfb226863e68a25a4115 Mon Sep 17 00:00:00 2001 From: Logan Page Date: Sat, 9 Mar 2024 11:47:24 +0200 Subject: [PATCH] fix: sort collected tests by test name --- src/pytest_cython/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pytest_cython/plugin.py b/src/pytest_cython/plugin.py index 28be1ba..62e0bfd 100644 --- a/src/pytest_cython/plugin.py +++ b/src/pytest_cython/plugin.py @@ -195,7 +195,7 @@ def collect(self): del tests[test_name] tests[equiv_test_name].lineno = lineno - for test in tests.values(): + for test in sorted(tests.values(), key=lambda x: x.name): if test.examples: # skip empty doctests if hasattr(DoctestItem, 'from_parent'): yield DoctestItem.from_parent(self, name=test.name, runner=runner, dtest=test)