jerry-git / jerry-git/pytest-split

feature request: order tests by slowest-first

Đang mở
#89 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
325
Fork
56
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

in long running test suites (especially with xdist), it's useful to run the slowest tests first so that you end up with better load. the following code seems to do so:
```
def pytest_collection_modifyitems(config, items):
try:
with open(".test_durations") as f:
s = f.read()
durations = json.loads(s)
except FileNotFoundError:
durations = {}

timings = {}
for item in items:
path, _, reqname = item.location
request_id = f"{path}::{reqname}"
timing = durations.get(request_id, None)
if timing is not None:
timings[item] = timing

meantime = sum(timings.values()) / len(timings)
# sort by highest time first
items.sort(key=lambda item: -timings.get(item, meantime))
```
but i was thinking it might be good for this to be available in the pytest-split plugin itself, so we don't need to add this same function across different projects.

alternatively, i was thinking publishing this as a plugin myself, if pytest-split does not want to add it.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Start by reading the pytest-split plugin entry points around collection modification and the existing handling of .test_durations. Check how xdist-related splitting is currently implemented and whether the proposed pytest_collection_modifyitems hook fits the plugin's flow. Done means the plugin can order tests slowest-first without requiring repeated project-specific code.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
testing-qa
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.