Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion utils/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
def slow_test_threshold(total_tests: int) -> int:
percentile = (100 - SLOW_TEST_PERCENTILE) / 100
slow_tests_to_return = floor(percentile * total_tests)
return max(slow_tests_to_return, 1)
return min(max(slow_tests_to_return, 1), 100)


class ArrayLength(Func):
Expand Down
23 changes: 23 additions & 0 deletions utils/tests/unit/test_slow_test_threshold.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import pytest

from utils.test_results import slow_test_threshold


@pytest.mark.parametrize(
"total_tests, expected_threshold",
[
(0, 1),
(1, 1),
(10, 1),
(100, 5),
(1000, 50),
(10000, 100),
(1000000, 100),
(20, 1),
(50, 2),
(200, 10),
(2000, 100),
],
)
def test_slow_test_threshold(total_tests, expected_threshold):
assert slow_test_threshold(total_tests) == expected_threshold
Loading