All tests fail with 'EXITED with status 3' on pytest 9.2.0 (TestReport._id is not marshallable)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 66/100
Hướng nghiên cứu
Lỗi xuất phát từ serialize_report(), hàm này sao chép TestReport.dict trước khi tiến trình con gửi nó bằng marshal.dumps(). Hãy bắt đầu bằng cách tái hiện lỗi với ví dụ test_min.py dưới pytest 9.2.0 và --forked, sau đó kiểm tra giá trị nào trong dict của báo cáo không thể marshal. Hoàn thành khi lần chạy có --forked thành công dưới pytest 9.2.0 và khi có lỗi xảy ra, ngoại lệ của tiến trình con được in ra trước khi gọi os._exit(3).
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
With pytest 9.2.0, every test run under --forked fails, including ones that pass, with running the test EXITED with status 3. pytest 9.1.1 works.
Reproduce
# test_min.py
def test_ok():
assert True
$ pip install pytest==9.2.0 pytest-forked==1.7.5
$ pytest --forked -q test_min.py
FAILED test_min.py::test_ok - .../test_min.py:1: running the test EXITED with status 3
1 failed
Seen on macOS (Darwin 27.2, Python 3.14.7) and on GitHub's ubuntu-latest and macOS runners.
Cause
pytest 9.2.0 adds a private _id attribute to TestReport, holding a NodeId object. serialize_report() copies rep.__dict__ and the child sends it with marshal.dumps(), which raises ValueError: unmarshallable object on NodeId. The child catches the exception and exits with EXITSTATUS_EXCEPTION (3), so the actual error is never shown.
Checking each value of serialize_report(report) with marshal.dumps shows _id (type NodeId) is the only one that fails under 9.2.0, for the setup, call and teardown reports. There are no failures under 9.1.1.
Possible fix
Drop or stringify values marshal can't handle in serialize_report(), e.g. skip private (_-prefixed) keys, or convert unknown types with str(). pytest-xdist's report serialization goes through config.hook.pytest_report_to_serialize / pytest_report_from_serialized, which pytest keeps compatible. Using those hooks would avoid depending on TestReport.__dict__ at all.
It would also help to print the child's exception (or write it to the stderr capture) before os._exit(3), so the next failure of this kind is self-explanatory.
- Ngôn ngữ chính
- Python
- Star
- 84
- Fork
- 30
- 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
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-forked
-
`ResourceWarning`/`PytestUnraisableExceptionWarning` with version 1.7.5Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
pytest-dev/pytest-forked#106 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
pytest-dev/pytest-forked#84 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
pytest-dev/pytest-forked#111 · 2 bình luận ·
-
Fork per subpathĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
pytest-dev/pytest-forked#94 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
pytest-dev/pytest-forked#88 · 12 bình luận ·
Tất cả issue của pytest-dev/pytest-forked
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
elviskahoro/sdk-python-attio#144 · 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 84/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 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
RenyiELBO raises TypeError when model has no sample sitesCó thể đã có người làm @alibb007 đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày