Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

PytestAssertRewriteWarning due to runpytest and pytest_plugins

Đang mở
#1,334 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

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

Hướng nghiên cứu

Bắt đầu với sáu test được nêu trong tests/markers/ và tests/test_event_loop_fixture.py, sau đó so sánh việc sử dụng runpytest_subprocess của chúng với commit 18afc9df5a3153dc1fbdc4e11a56517ef95480df. Chạy các test bị ảnh hưởng trên Python 3.11 và kiểm tra cách pytest_plugins tương tác với cơ chế tự động phát hiện plugin. Hoàn thành khi các test được liệt kê không còn phát ra PytestAssertRewriteWarning mà vẫn giữ nguyên hành vi hiện có.

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

Mô tả

Originally posted by @McSinyx in https://github.com/pytest-dev/pytest-asyncio/issues/1275#issuecomment-3737477316

On Python 3.11 on Guix (full test log), PytestAssertRewriteWarning resurfaces for the following tests due to 18afc9df5a3153dc1fbdc4e11a56517ef95480df replacing runpytest with runpytest_subprocess:

tests/markers/test_class_scope.py::test_standalone_test_does_not_trigger_warning_about_no_current_event_loop_being_set
tests/markers/test_function_scope.py::test_warns_when_scope_argument_is_present
tests/markers/test_module_scope.py::test_standalone_test_does_not_trigger_warning_about_no_current_event_loop_being_set
tests/markers/test_session_scope.py::test_standalone_test_does_not_trigger_warning_about_no_current_event_loop_being_set
tests/test_event_loop_fixture.py::test_event_loop_fixture_handles_unclosed_async_gen
tests/test_event_loop_fixture.py::test_event_loop_fixture_asyncgen_error

IIUC this commit tries to workaround a case in GH-1227 where a system pytest-asyncio package takes precedence over a local one. Our fix for Guix also involves removing pytest_plugins = 'pytest_asyncio' in the following tests because it also marks the package for assertion rewriting while it's already imported before executing the scripts as part of plugin autodiscovery.

tests/test_event_loop_fixture.py::test_event_loop_fixture_handles_unclosed_async_gen
tests/test_event_loop_fixture.py::test_event_loop_fixture_asyncgen_error
Ngôn ngữ chính
Python
Star
1.7k
Fork
207
Merge trung bình
4 giờ 38 phút
Pull request đã merge (30 ngày)
12

Chuẩn bị môi trường

Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của pytest-dev/pytest-asyncio

Tất cả issue của pytest-dev/pytest-asyncio

Issue tương tự

Thêm issue về Python

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.