AttributeError on Debug Run with PyTest
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- devtools, testing-qa
Research direction
Start by reproducing the pytest run with debugpy 1.8.16 and comparing it with 1.8.15. Read debugpy/adapter/main.py, debugpy/public_api.py, and the bundled dataclasses.py around the reported _ClassVar lookup; done means collection completes and wait_for_client() no longer times out under the reported environment.
Written by the indexing model from the issue text.
Description
Environment data
- debugpy version: 1.8.16
- OS and version: Ubuntu 20.04.6 LTS
- Python version: 3.12.3
- Using VS Code or Visual Studio: VS Code
Actual behavior
collecting ... Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/jp/.pyenv/versions/3.12.3/envs/dev/lib/python3.12/site-packages/debugpy/adapter/__main__.py", line 229, in <module>
__import__("debugpy")
File "/home/jp/.pyenv/versions/3.12.3/envs/dev/lib/python3.12/site-packages/debugpy/adapter/../../debugpy/__init__.py", line 36, in <module>
from debugpy.public_api import * # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jp/.pyenv/versions/3.12.3/envs/dev/lib/python3.12/site-packages/debugpy/adapter/../../debugpy/public_api.py", line 25, in <module>
@dataclasses.dataclass(frozen=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jp/.pyenv/versions/3.12.3/envs/dev/lib/python3.12/site-packages/debugpy/adapter/../../dataclasses.py", line 950, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jp/.pyenv/versions/3.12.3/envs/dev/lib/python3.12/site-packages/debugpy/adapter/../../dataclasses.py", line 800, in _process_class
cls_fields = [_get_field(cls, name, type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jp/.pyenv/versions/3.12.3/envs/dev/lib/python3.12/site-packages/debugpy/adapter/../../dataclasses.py", line 659, in _get_field
if (_is_classvar(a_type, typing)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jp/.pyenv/versions/3.12.3/envs/dev/lib/python3.12/site-packages/debugpy/adapter/../../dataclasses.py", line 550, in _is_classvar
return type(a_type) is typing._ClassVar
^^^^^^^^^^^^^^^^
AttributeError: module 'typing' has no attribute '_ClassVar'. Did you mean: 'ClassVar'?
Expected behavior
PyTest collects test(s), macro in code waits for connection from VS Code, debugging proceeds.
Steps to reproduce:
Use debugpy version 1.8.16 (downgrading to 1.8.15 fixed the problem), run a pytest for code that contains the debugpy code macro as I have below and wait a few seconds. The traceback will be reported and the wait_for_client() call will time out.
import debugpy
debugpy.listen(5679)
debugpy.wait_for_client()
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 202
- Avg merge
- 5d 1h
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/debugpy
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
All issues in microsoft/debugpy
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
learningequality/ricecooker#747 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
run-llama/llama_index#23199 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
KhronosGroup/glTF-Blender-IO#2769 ·