From 7bc7d3af2a7ea3870edea528fd6b9e68a1039929 Mon Sep 17 00:00:00 2001 From: Vijay Janapa Reddi Date: Sun, 20 Jul 2025 13:02:21 -0400 Subject: [PATCH] Implement logical test sequencing - unit tests run first, then integration tests --- tito/tools/testing.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tito/tools/testing.py b/tito/tools/testing.py index d60b4cb3..bf90f3c8 100644 --- a/tito/tools/testing.py +++ b/tito/tools/testing.py @@ -74,8 +74,22 @@ class ModuleTestRunner: test_name = self._function_name_to_test_name(name) discovered_tests.append((test_name, obj)) - # Sort tests for consistent order - discovered_tests.sort(key=lambda x: x[0]) + # Sort tests for logical sequence: unit tests first, then integration tests + def test_priority(test_tuple): + test_name, test_function = test_tuple + function_name = test_function.__name__ + + # Unit tests (test_unit_*) have highest priority + if function_name.startswith('test_unit_'): + return 0 + # Integration tests (test_module_*) have medium priority + elif function_name.startswith('test_module_'): + return 1 + # All other tests have lowest priority + else: + return 2 + + discovered_tests.sort(key=test_priority) # Register discovered tests for test_name, test_function in discovered_tests: