Don't warn about `asyncio_default_fixture_loop_scope` unless the test suite uses `pytest-asyncio`
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
- 52/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả 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 pytest_asyncio/plugin.py tại cảnh báo được báo cáo gần dòng 247 trong pytest_configure, sau đó tái hiện hành vi bằng cách sử dụng test_a.py và pytester.runpytest_inprocess. Chạy các lệnh pytest được liệt kê với pytest-asyncio đã được cài đặt; hoàn tất khi bộ kiểm thử không có test async chạy thành công với -Werror mà không xóa hoặc làm nhẹ cảnh báo deprecation khi pytest-asyncio thực sự được sử dụng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi all. I am not a user of pytest-asyncio, but it has gotten installed to my environment through one transitive dependency or another.
My test suite has no async tests and runs under -Werror. One of my tests uses pytester.runpytest_inprocess, which fails iff pytest-asyncio is installed due to the deprecation warning:
INTERNALERROR> File "/Users/tybug/.local/share/uv/python/cpython-3.13.11-macos-aarch64-none/lib/python3.13/site-packages/pytest_asyncio/plugin.py", line 247, in pytest_configure
INTERNALERROR> warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET))
INTERNALERROR> ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> pytest.PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset.
INTERNALERROR> The event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to function scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session"
================================================================= short test summary info ==================================================================
FAILED test_a.py::test_a - assert <ExitCode.INTERNAL_ERROR: 3> == 0
==================================================================== 1 failed in 0.06s =====================================================================
~/Desktop/pytest_inprocess_repro λ
Reproduction steps:
mkdir pytest_asyncio_repro && cd pytest_asyncio_repro
uv venv .venv --python 3.12
uv pip install --python .venv/bin/python pytest pytest-asyncio
# test_a.py
pytest_plugins = ["pytester"]
def test_a(pytester):
pytester.makepyfile(test_inner="""
def test_b(): pass
""")
result = pytester.runpytest_inprocess()
assert result.ret == 0
.venv/bin/python -m pytest test_a.py: passes.venv/bin/python -m pytest test_a.py -Werror: fails
I'm not asking for the deprecation warning to be removed or relaxed. But it would be really great if having pytest-asyncio installed in my environment didn't cause my tests to fail!
I also don't know why this requires pytester.runpytest_inprocess to trigger. I would expect this to be a problem when running pytest at the top level as well. This may be why nobody has complained about this yet.
- Ngôn ngữ chính
- Python
- Star
- 1.7k
- Fork
- 211
- Merge trung bình
- 5 giờ 2 phút
- Pull request đã merge (30 ngày)
- 11
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: 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
- Đọ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 pytest-dev/pytest-asyncio
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
pytest-dev/pytest-asyncio#1475 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 56/100
pytest-dev/pytest-asyncio#1514 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
pytest-dev/pytest-asyncio#1501 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
pytest-dev/pytest-asyncio#1463 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
pytest-dev/pytest-asyncio#1334 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của pytest-dev/pytest-asyncio
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
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 85/100
kornia/kornia#5263 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Metadata correction for W16-5400Đang mởapproved correction metadata
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
acl-org/acl-anthology#10133 · 1 bình luận ·
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 78/100
BasedHardware/omi#20084 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs-acceptance wg/evaluation-quality
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
vllm-project/semantic-router#4424 ·
Maintainer thường phản hồi trong vòng 1 ngày