Make Memory-Related Tests Less Fragile
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 35.9k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
Feature or enhancement
Proposal:
There are a number of tests that check various aspects of memory management, typically related to some specific module or feature. Nearly every one of these tests is fairly tightly coupled to the fine details of our memory management implementation, usually tied to specific numbers.
This makes the tests fragile, often breaking with even slight changes to some aspect of memory management. [^1]
[^1]: To be fair, we don't make changes to memory management very often; clearly these tests aren't breaking all the time.
For example, in https://github.com/python/cpython/pull/121134#issuecomment-2233412265, @Fidget-Spinner says:
It fails
test.test_gdb.test_pretty_print test_capi test_exceptions test_regrtest test_repl test_sys test_tracemallocmainly because they count allocations/test out of memory situations, and the hashtable adds random allocations which breaks their careful calculations.
[^2]
[^2]: Note that those aren't necessarily the only tests that need attention here.
Ideally, we would find a way to make such tests less coupled to specific numbers, without sacrificing the accuracy of the behavior checks they are making.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng việc xem xét các bài kiểm thử nhạy với bộ nhớ được nêu trong issue: test_gdb.test_pretty_print, test_capi, test_exceptions, test_regrtest, test_repl, test_sys và test_tracemalloc. Xác định các assertion về cấp phát hoặc hết bộ nhớ nào phụ thuộc vào số lượng cố định, sau đó xác định cách các kiểm tra hành vi của chúng vẫn có thể chính xác mà không cần những con số chính xác đó. Công việc được hoàn tất khi các bài kiểm thử bị ảnh hưởng chấp nhận những thay đổi liên quan trong việc quản lý bộ nhớ mà vẫn phát hiện được các hồi quy.
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ó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100