ImportError: cannot import name ‘resultlog_key‘ from ‘_pytest.resultlog‘
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
- 35/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 trong pytest_rerunfailures.py, đặc biệt là _get_resultlog và kiểm tra phiên bản HAS_RESULTLOG. Tái hiện lỗi import với pytest 7.3.2 và pytest-rerunfailures 12.0, sau đó xác minh rằng đường dẫn tương thích result-log không còn gây ra ImportError.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
def worker_internal_error(self, node, formatted_error):
"""
pytest_internalerror() was called on the worker.
pytest_internalerror() arguments are an excinfo and an excrepr, which can't
be serialized, so we go with a poor man's solution of raising an exception
here ourselves using the formatted message.
"""
self._active_nodes.remove(node)
try:
> assert False, formatted_error
E AssertionError: Traceback (most recent call last):
E File "/usr/local/lib/python3.7/site-packages/_pytest/main.py", line 269, in wrap_session
E session.exitstatus = doit(config, session) or 0
E File "/usr/local/lib/python3.7/site-packages/_pytest/main.py", line 323, in _main
E config.hook.pytest_runtestloop(session=session)
E File "/usr/local/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
E return self._hookexec(self, self.get_hookimpls(), kwargs)
E File "/usr/local/lib/python3.7/site-packages/pluggy/manager.py", line 92, in _hookexec
E return self._inner_hookexec(hook, methods, kwargs)
E File "/usr/local/lib/python3.7/site-packages/pluggy/manager.py", line 86, in <lambda>
E firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
E File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
E return outcome.get_result()
E File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
E raise ex[1].with_traceback(ex[2])
E File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
E res = hook_impl.function(*args)
E File "/usr/local/lib/python3.7/site-packages/xdist/remote.py", line 115, in pytest_runtestloop
E self.run_one_test(torun)
E File "/usr/local/lib/python3.7/site-packages/xdist/remote.py", line 131, in run_one_test
E self.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
E File "/usr/local/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
E return self._hookexec(self, self.get_hookimpls(), kwargs)
E File "/usr/local/lib/python3.7/site-packages/pluggy/manager.py", line 92, in _hookexec
E return self._inner_hookexec(hook, methods, kwargs)
E File "/usr/local/lib/python3.7/site-packages/pluggy/manager.py", line 86, in <lambda>
E firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
E File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
E return outcome.get_result()
E File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
E raise ex[1].with_traceback(ex[2])
E File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
E res = hook_impl.function(*args)
E File "/usr/local/lib/python3.7/site-packages/pytest_rerunfailures.py", line 593, in pytest_runtest_protocol
E check_options(item.session.config)
E File "/usr/local/lib/python3.7/site-packages/pytest_rerunfailures.py", line 145, in check_options
E resultlog = _get_resultlog(config)
E File "/usr/local/lib/python3.7/site-packages/pytest_rerunfailures.py", line 117, in _get_resultlog
E from _pytest.resultlog import resultlog_key
E ImportError: cannot import name 'resultlog_key' from '_pytest.resultlog' (/usr/local/lib/python3.7/site-packages/_pytest/resultlog.py)
E assert False
/usr/local/lib/python3.7/site-packages/xdist/dsession.py:190: AssertionError
Package Version:
pytest 7.3.2
pytest-rerunfailures 12.0
I know _pytest.resultlog was removed in pytest 6.1.0
search for source code:
HAS_RESULTLOG = False
try:
from _pytest.resultlog import ResultLog
HAS_RESULTLOG = True
except ImportError:
# We have a pytest >= 6.1
pass
def _get_resultlog(config):
if not HAS_RESULTLOG:
return None
elif PYTEST_GTE_54:
# hack
from _pytest.resultlog import resultlog_key
return config._store.get(resultlog_key, default=None)
else:
return getattr(config, "_resultlog", None)
so when I have a pytest >= 6.1 “from _pytest.resultlog import resultlog_key” should not be executed !
maybe because ”from _pytest.resultlog import ResultLog“ not reise Exception unexpected ,which means though i have a pytest >= 6.1 ,_pytest.resultlog was not removed?
- Ngôn ngữ chính
- Python
- Star
- 480
- Fork
- 110
- 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 pytest-dev/pytest-rerunfailures
-
Zero rerun delay can abort with OverflowError for a large finite backoff factorCó thể đã có người làm @AryanRG đã nhận 12 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Non-finite rerun delay settings abort pytest with INTERNALERRORCó thể đã có người làm @Arham-Begani đã nhận 10 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
-
fail-on-flaky returns success after a rerun with xdistCó thể đã có người làm @harbinresearcher đã nhận 13 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
pytest-dev/pytest-rerunfailures#326 · 7 bình luận ·
-
Add ability to raise runtime warnings on rerunsCó thể đã có người làm @LouisDeconinck đã nhận 41 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
pytest-dev/pytest-rerunfailures#318 · 2 bình luận ·
Tất cả issue của pytest-dev/pytest-rerunfailures
Issue tương tự
-
area/profiles comp/cli P3 type/feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
NousResearch/hermes-agent#146372 ·
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 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[oblt-aw][autodoc] Document obs-aw-automerge contract and fix automerge doc inconsistenciesCó thể đã có người làm @github-actions đã nhận hôm nay. Đang mở
Độ 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
-
GeoSeries scale and skew tests fail with pytest 9.2.0Có thể đã có người làm @jiayuasu đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
admission-deferred priority: medium status: ready work-class: scoped
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
melodic-software/claude-code-plugins#10887 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày