Repository navigation
Conversation
Signed-off-by: Uzini <43294422+Uziniii@users.noreply.github.com>
|
It seems that the original implementation was also sorting in ascending order Line 1756 in a16a0fe |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65603 +/- ##
==========================================
- Coverage 90.12% 90.05% -0.07%
==========================================
Files 751 751
Lines 252638 254919 +2281
Branches 47551 48130 +579
==========================================
+ Hits 227689 229579 +1890
- Misses 16238 16520 +282
- Partials 8711 8820 +109 🚀 New features to boost your workflow:
|
|
I checked the exact historical implementation and reproduced it with Python 2.7 in Docker. The original code was: def CompareTime(self, other):
return cmp(other.duration, self.duration)
timed_tests.sort(lambda a, b: a.CompareTime(b))Running it with durations [10, 1, 5] produces: [10, 5, 1] The cmp() arguments are reversed, so the resulting order is descending. The later replacement in 1fc4255 changed this to: timed_tests.sort(key=lambda x: x.duration) which produces [1, 5, 10]. Therefore, reverse=True restores the original behavior. This also matches the descending output documented in #27007. |
The
--timeoption displays only the first 20 entries after sorting test durations. The current ascending sort therefore reports the fastest tests.Before
1fc4255221,CompareTime()sorted durations in descending order.That commit replaced the comparator with an ascending key-based sort while modernizing the Python code.
Sort durations in descending order to restore the historical behavior and report the tests that contribute most to the suite's execution time.
This also matches the output documented in: #27007
The change was verified with:
AI assistance was used to investigate the Git history and write this description as im not a native english. I reviewed and verified the change.