Support for interleaved errors
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 30/100
Hướng nghiên cứu
Start by reviewing the linked implementation in tests/mypy_helpers.py and its usage in tests/test_plugin.py, then inspect assertion rewriting in tests/init.py. Compare the proposed interleaved-error format with the current test expectations and determine the required plugin behavior and test coverage before deciding whether the approach can be supported.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Here's what I came up with while trying to replicate mypy's own testcases, which interleave the expected errors in the source code like so:
https://github.com/ikonst/pynamodb-mypy/blob/9453404f576c4ead04749d61eb041e10bec13229/tests/test_plugin.py
The implementation is here:
https://github.com/ikonst/pynamodb-mypy/blob/9453404f576c4ead04749d61eb041e10bec13229/tests/mypy_helpers.py
In a failure case, the failed assertion output will look like:
> assert actual == expected
E assert 'from pynamod...ibute "lower"' == 'from pynamodb..._attr.lower()'
E from pynamodb.attributes import UnicodeAttribute
E from pynamodb.models import Model
E
E class MyModel(Model):
E my_attr = UnicodeAttribute(null=True)
E
E reveal_type(MyModel.my_attr) # E: Revealed type is 'pynamodb.attributes._NullableAttribute[pynamodb.attributes.UnicodeAttribute, builtins.str]'
E reveal_type(MyModel().my_attr) # E: Revealed type is 'Union[builtins.str*, None]'
E - MyModel().my_attr.lower() # E: Item "None" of "Optional[str]" has no attribute "lower"
E + MyModel().my_attr.lower()
Of course, this requires assertion rewriting, which would've been done in the pytest plugin normally:
https://github.com/ikonst/pynamodb-mypy/blob/9453404f576c4ead04749d61eb041e10bec13229/tests/__init__.py#L3
There are two advantages of interleaving the errors in the test code:
- changing the test code does not necessitate updating of line numbers
- updating the test code is easier (by diffing the program against the "expected program", i.e. data-driven testing)
Have you considered allowing a similar approach?
- Ngôn ngữ chính
- Python
- Star
- 257
- Fork
- 33
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc 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.
Issue khác của realpython/pytest-mypy
-
integration
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
realpython/pytest-mypy#196 · 2 bình luận ·
-
VS Code Support for pytest-mypyCó thể làm lại được @eleanorjboyd đã nhận 484 ngày trước và không có pull request nào đang mở. Đang mở
realpython/pytest-mypy#190 · 1 bình luận · 1 người được giao ·
-
integration
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
realpython/pytest-mypy#160 · 4 bình luận ·
-
integration
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
realpython/pytest-mypy#138 · 2 bình luận · 2 reaction ·
-
Expected mypy errorsCó thể làm lại được @dcbaker đã nhận 715 ngày trước và không có pull request nào đang mở. Đang mở
realpython/pytest-mypy#105 · 4 bình luận · 1 người được giao ·
Tất cả issue của realpython/pytest-mypy
Issue tương tự
-
Action calls retired claude-3-5-haiku-20241022, generating failing API requests for every userĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 92/100
-
enhancement P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Toloka/tolokaforge#1776 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
TencentCloud/Octop#1622 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[arch] gate_sync.sh: stale remote tmp files on install failure; overlapping cron runs unguardedĐang mởarch area:fleet priority:p3 severity:low track:hosted-product
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày