AttributeError: 'ChannelFileWrite' object has no attribute 'encoding'
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
- 42/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
- distributed-systems
Hướng nghiên cứu
Tái hiện lỗi với execnet, pytest-xdist và teamcity-messages đã được cài đặt, bắt đầu từ gateway_base.py của execnet và đối tượng ChannelFileWrite trong traceback. Kiểm tra teamcity/common.py, nơi sys.stdout.encoding được đọc, sau đó chạy các bài kiểm thử pytest-xdist bị ảnh hưởng với và không có teamcity-messages. Hoàn tất khi plugin được tải mà không gặp AttributeError này và các bài kiểm thử đều đạt.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
When I try to run testsuite for pytest-xdist and both execnet and teamcity-messages are installed few tests fails with errors like:
__________________ TestRemoteControl.test_failures_somewhere ___________________
self = <test_looponfail.TestRemoteControl object at 0x7fffaa00c7c0>
pytester = <Pytester PosixPath('/tmp/pytest-of-marcel/pytest-10/test_failures_somewhere0')>
def test_failures_somewhere(self, pytester: pytest.Pytester) -> None:
item = pytester.getitem("def test_func():\n assert 0\n")
control = RemoteControl(item.config)
control.setup()
> failures = control.runsession()
$(BLDDIR)/testing/test_looponfail.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
$(INSTDIR)/usr/lib/python3.9/vendor-packages/xdist/looponfail.py:117: in runsession
return self.channel.receive()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Channel id=1 closed>, timeout = None
def receive(self, timeout=None):
"""receive a data item that was sent from the other side.
timeout: None [default] blocked waiting. A positive number
indicates the number of seconds after which a channel.TimeoutError
exception will be raised if no item was received.
Note that exceptions from the remotely executing code will be
reraised as channel.RemoteError exceptions containing
a textual representation of the remote traceback.
"""
itemqueue = self._items
if itemqueue is None:
raise IOError("cannot receive(), channel has receiver callback")
try:
x = itemqueue.get(timeout=timeout)
except self.gateway.execmodel.queue.Empty:
raise self.TimeoutError("no item after %r seconds" % timeout)
if x is ENDMARKER:
itemqueue.put(x) # for other receivers
> raise self._getremoteerror() or EOFError()
E execnet.gateway_base.RemoteError: Traceback (most recent call last):
E File "/usr/lib/python3.9/vendor-packages/execnet/gateway_base.py", line 1088, in executetask
E function(channel, **kwargs)
E File "$(INSTDIR)/usr/lib/python3.9/vendor-packages/xdist/looponfail.py", line 171, in init_worker_session
E config = Config.fromdictargs(option_dict, list(args))
E File "/usr/lib/python3.9/vendor-packages/_pytest/config/__init__.py", line 1110, in fromdictargs
E config.parse(args, addopts=False)
E File "/usr/lib/python3.9/vendor-packages/_pytest/config/__init__.py", line 1346, in parse
E self._preparse(args, addopts=addopts)
E File "/usr/lib/python3.9/vendor-packages/_pytest/config/__init__.py", line 1229, in _preparse
E self.pluginmanager.load_setuptools_entrypoints("pytest11")
E File "/usr/lib/python3.9/vendor-packages/pluggy/_manager.py", line 287, in load_setuptools_entrypoints
E plugin = ep.load()
E File "/usr/lib/python3.9/importlib/metadata.py", line 86, in load
E module = import_module(match.group('module'))
E File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
E return _bootstrap._gcd_import(name[level:], package, level)
E File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
E File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
E File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
E File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
E File "/usr/lib/python3.9/vendor-packages/_pytest/assertion/rewrite.py", line 168, in exec_module
E exec(co, module.__dict__)
E File "/usr/lib/python3.9/vendor-packages/teamcity/pytest_plugin.py", line 22, in <module>
E from teamcity.common import convert_error_to_string, dump_test_stderr, dump_test_stdout
E File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
E File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
E File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
E File "/usr/lib/python3.9/vendor-packages/_pytest/assertion/rewrite.py", line 168, in exec_module
E exec(co, module.__dict__)
E File "/usr/lib/python3.9/vendor-packages/teamcity/common.py", line 19, in <module>
E _sys_stdout_encoding = sys.stdout.encoding
E AttributeError: 'ChannelFileWrite' object has no attribute 'encoding'
/usr/lib/python3.9/vendor-packages/execnet/gateway_base.py:749: RemoteError
With teamcity-messages uninstalled these tests pass.
- Ngôn ngữ chính
- Python
- Star
- 102
- Fork
- 47
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
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/execnet
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
pytest-dev/execnet#429 · 1 bình luận ·
-
IPv6 support Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
pytest-dev/execnet#384 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
pytest-dev/execnet#374 · 3 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
pytest-dev/execnet#306 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
pytest-dev/execnet#279 · 1 reaction ·
Tất cả issue của pytest-dev/execnet
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anthropics/skills#1811 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
speaches-ai/speaches#678 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
datalayer/mcp-compose#42 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
conda-forge/spacy-feedstock#177 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
UKGovernmentBEIS/inspect_evals#2523 ·