Closed
Description
Type: Bug
Behaviour
I'm working on a poetry project with pytest and pytest-describe.
Tests are not recognized by the python extension.
My .vscode/settings.json
contains
"python.experiments.optInto": ["pythonTestAdapter"],
However, despite setting "Trace" in VSCode Output "Python", there's no "Experiment" in the output.
Steps to reproduce:
- Set up a project with
pytest-describe
. - Configure
pytest
inpyproject.toml
with
[tool.pytest.ini_options]
describe_prefixes = [
"describe_",
"when_",
"with_",
"without_",
"if_",
"unless_",
"for_",
]
- Create test file in
tests/convert/test_convert_command.py
with nested describe structure, e.g.
def describe_convert_command():
@pytest.fixture
def content():
return None
@pytest.fixture
def from_format():
return None
@pytest.fixture
def command(content, from_format):
return ConvertCommand(content=content, from_format=from_format)
@pytest.fixture
def result(command):
return command.convert()
def describe_init():
def with_format_go_licenses():
@pytest.fixture
def from_format():
return "go-licenses"
def with_valid_invalid_file_format():
@pytest.fixture
def content():
return inspect.cleandoc("""some key\nsome value""")
def it_raises_a_value_error(command):
with pytest.raises(ValueError):
command.convert()
Diagnostic data
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
2024-12-27 18:19:53.418 [debug] Found cached env for /u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/bin/python
2024-12-27 18:19:53.771 [debug] Testing: Trigger refresh after saving /u/ks/src/myproject/tests/convert/test_convert_command.py
2024-12-27 18:19:54.026 [debug] Delay Trigger[Refresh Test Data]: triggered=12, called=12
2024-12-27 18:19:54.026 [info] Discover tests for workspace name: myproject - uri: /u/ks/src/myproject/tests/convert/test_convert_command.py
2024-12-27 18:19:54.026 [debug] Found cached env for /u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/bin/python
2024-12-27 18:19:54.026 [debug] could not find a pixi interpreter for the interpreter at /u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/bin/python
2024-12-27 18:19:54.028 [debug] Activation Commands received source /u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/bin/activate for shell bash, resource /u/ks/src/myproject and interpreter /u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/bin/python
2024-12-27 18:19:54.028 [debug] Activating Environment to capture Environment variables, . /u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/printEnvVariables.py
2024-12-27 18:19:54.028 [info] > . ~/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/printEnvVariables.py
2024-12-27 18:19:54.028 [info] shell: bash
2024-12-27 18:19:54.083 [info] > ~/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/bin/python ~/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/run_adapter.py discover pytest -- --rootdir . -s --cache-clear
2024-12-27 18:19:54.083 [info] cwd: .
2024-12-27 18:19:54.366 [error] Error discovering pytest tests:
n [Error]: ============================= test session starts ==============================
platform darwin -- Python 3.12.4, pytest-8.3.4, pluggy-1.5.0
rootdir: /u/ks/src/myproject
configfile: pyproject.toml
plugins: describe-2.2.0, cov-6.0.0, spec-4.0.0, mock-3.14.0
The Python extension has run into an unexpected situation
while processing a pytest node during test discovery. Please
Please open an issue at:
https://github.com/microsoft/vscode-python/issues
and paste the following output there.
nodeid: tests/convert/test_convert_command.py::describe_convert_command::describe_init::with_format_go_licenses::with_invalid_file_format::it_raises_a_value_error
kind: ('function', False)
class: Function
name: it_raises_a_value_error
fspath: /u/ks/src/myproject/tests/convert/test_convert_command.py
location: ('tests/convert/test_convert_command.py', 53, 'it_raises_a_value_error')
function: <function describe_convert_command.<locals>.describe_init.<locals>.with_format_go_licenses.<locals>.with_invalid_file_format.<locals>.it_raises_a_value_error at 0x106c56a20>
markers: []
user_properties: []
attrnames: ['_ALLOW_MARKERS', '__abstractmethods__', '__annotations__', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '__weakref__', '_abc_impl', '_check_item_and_collector_diamond_inheritance', '_fixtureinfo', '_getinstance', '_getobj', '_initrequest', '_instance', '_nodeid', '_obj', '_pyfuncitem', '_pytest_diamond_inheritance_warning_shown', '_report_sections', '_repr_failure_py', '_request', '_store', '_traceback_filter', 'add_marker', 'add_report_section', 'addfinalizer', 'cls', 'config', 'extra_keyword_matches', 'fixturenames', 'from_parent', 'fspath', 'funcargs', 'function', 'get_closest_marker', 'getmodpath', 'getparent', 'ihook', 'instance', 'iter_markers', 'iter_markers_with_node', 'iter_parents', 'keywords', 'listchain', 'listextrakeywords', 'listnames', 'location', 'module', 'name', 'nextitem', 'nodeid', 'obj', 'originalname', 'own_markers', 'parent', 'path', 'reportinfo', 'repr_failure', 'runtest', 'session', 'setup', 'stash', 'teardown', 'user_properties', 'warn']
extra info:
fullname: it_raises_a_value_error
testfunc: describe_convert_command.describe_init.with_format_go_licenses.with_invalid_file_format.it_raises_a_value_error
parameterized:
traceback:
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/run_adapter.py", line 18, in <module>
main(tool, cmd, subargs, toolargs)
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/__main__.py", line 96, in main
parents, result = run(toolargs, **subargs)
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/pytest/_discovery.py", line 29, in discover
ec = _pytest_main(pytestargs, [_plugin])
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/config/__init__.py", line 175, in main
ret: ExitCode | int = config.hook.pytest_cmdline_main(config=config)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/main.py", line 330, in pytest_cmdline_main
return wrap_session(config, _main)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/main.py", line 283, in wrap_session
session.exitstatus = doit(config, session) or 0
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/main.py", line 336, in _main
config.hook.pytest_collection(session=session)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/main.py", line 347, in pytest_collection
session.perform_collect()
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/main.py", line 812, in perform_collect
hook.pytest_collection_modifyitems(
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/pytest/_discovery.py", line 86, in pytest_collection_modifyitems
test, parents = self.parse_item(item)
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/pytest/_discovery.py", line 71, in parse_item
return parse_item(item)
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 182, in parse_item
raise should_never_reach_here(
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 130, in should_never_reach_here
traceback.print_stack()
collected 71 items
<Dir myproject>
<Package tests>
<Dir convert>
<Module test_convert_command.py>
<DescribeBlock 'describe_convert_command'>
<DescribeBlock 'describe_init'>
<DescribeBlock 'with_format_go_licenses'>
<DescribeBlock 'with_invalid_file_format'>
<Function it_raises_a_value_error>
<DescribeBlock 'with_missing_required_fields'>
<Function it_raises_a_value_error>
<DescribeBlock 'with_valid_content'>
<Function it_returns_correct_licenses>
...some more modules listed
<DescribeBlock 'with_whitelisted_package'>
<Function it_returns_false>
<Function it_has_warnings>
The Python extension has run into an unexpected situation
while processing a pytest node during test discovery. Please
Please open an issue at:
https://github.com/microsoft/vscode-python/issues
and paste the following output there.
nodeid: tests/convert/test_convert_command.py::describe_convert_command::describe_init::with_format_go_licenses::with_invalid_file_format::it_raises_a_value_error
kind: ('function', False)
class: Function
name: it_raises_a_value_error
fspath: /u/ks/src/myproject/tests/convert/test_convert_command.py
location: ('tests/convert/test_convert_command.py', 53, 'it_raises_a_value_error')
function: <function describe_convert_command.<locals>.describe_init.<locals>.with_format_go_licenses.<locals>.with_invalid_file_format.<locals>.it_raises_a_value_error at 0x106c56a20>
markers: []
user_properties: []
attrnames: ['_ALLOW_MARKERS', '__abstractmethods__', '__annotations__', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '__weakref__', '_abc_impl', '_check_item_and_collector_diamond_inheritance', '_fixtureinfo', '_getinstance', '_getobj', '_initrequest', '_instance', '_nodeid', '_obj', '_pyfuncitem', '_pytest_diamond_inheritance_warning_shown', '_report_sections', '_repr_failure_py', '_request', '_store', '_traceback_filter', 'add_marker', 'add_report_section', 'addfinalizer', 'cls', 'config', 'extra_keyword_matches', 'fixturenames', 'from_parent', 'fspath', 'funcargs', 'function', 'get_closest_marker', 'getmodpath', 'getparent', 'ihook', 'instance', 'iter_markers', 'iter_markers_with_node', 'iter_parents', 'keywords', 'listchain', 'listextrakeywords', 'listnames', 'location', 'module', 'name', 'nextitem', 'nodeid', 'obj', 'originalname', 'own_markers', 'parent', 'path', 'reportinfo', 'repr_failure', 'runtest', 'session', 'setup', 'stash', 'teardown', 'user_properties', 'warn']
extra info:
fullname: it_raises_a_value_error
testfunc: describe_convert_command.describe_init.with_format_go_licenses.with_invalid_file_format.it_raises_a_value_error
parameterized:
traceback:
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/run_adapter.py", line 18, in <module>
main(tool, cmd, subargs, toolargs)
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/__main__.py", line 96, in main
parents, result = run(toolargs, **subargs)
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/pytest/_discovery.py", line 29, in discover
ec = _pytest_main(pytestargs, [_plugin])
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/config/__init__.py", line 175, in main
ret: ExitCode | int = config.hook.pytest_cmdline_main(config=config)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/main.py", line 330, in pytest_cmdline_main
return wrap_session(config, _main)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/main.py", line 283, in wrap_session
session.exitstatus = doit(config, session) or 0
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/main.py", line 336, in _main
config.hook.pytest_collection(session=session)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/main.py", line 347, in pytest_collection
session.perform_collect()
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/main.py", line 819, in perform_collect
hook.pytest_collection_finish(session=self)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/pytest/_discovery.py", line 101, in pytest_collection_finish
test, parents = self.parse_item(item)
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/pytest/_discovery.py", line 71, in parse_item
return parse_item(item)
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 182, in parse_item
raise should_never_reach_here(
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 130, in should_never_reach_here
traceback.print_stack()
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/main.py", line 812, in perform_collect
INTERNALERROR> hook.pytest_collection_modifyitems(
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
INTERNALERROR> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> raise exception.with_traceback(exception.__traceback__)
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/cacheprovider.py", line 443, in pytest_collection_modifyitems
INTERNALERROR> res = yield
INTERNALERROR> ^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/cacheprovider.py", line 373, in pytest_collection_modifyitems
INTERNALERROR> res = yield
INTERNALERROR> ^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/pytest/_discovery.py", line 86, in pytest_collection_modifyitems
INTERNALERROR> test, parents = self.parse_item(item)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/pytest/_discovery.py", line 71, in parse_item
INTERNALERROR> return parse_item(item)
INTERNALERROR> ^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 182, in parse_item
INTERNALERROR> raise should_never_reach_here(
INTERNALERROR> NotImplementedError: Unexpected pytest node (see printed output).
INTERNALERROR>
INTERNALERROR> During handling of the above exception, another exception occurred:
INTERNALERROR>
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/main.py", line 283, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/main.py", line 336, in _main
INTERNALERROR> config.hook.pytest_collection(session=session)
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
INTERNALERROR> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> raise exception.with_traceback(exception.__traceback__)
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/logging.py", line 790, in pytest_collection
INTERNALERROR> return (yield)
INTERNALERROR> ^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/warnings.py", line 121, in pytest_collection
INTERNALERROR> return (yield)
INTERNALERROR> ^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1417, in pytest_collection
INTERNALERROR> return (yield)
INTERNALERROR> ^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/main.py", line 347, in pytest_collection
INTERNALERROR> session.perform_collect()
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/_pytest/main.py", line 819, in perform_collect
INTERNALERROR> hook.pytest_collection_finish(session=self)
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
INTERNALERROR> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> raise exception.with_traceback(exception.__traceback__)
INTERNALERROR> File "/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/pytest/_discovery.py", line 101, in pytest_collection_finish
INTERNALERROR> test, parents = self.parse_item(item)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/pytest/_discovery.py", line 71, in parse_item
INTERNALERROR> return parse_item(item)
INTERNALERROR> ^^^^^^^^^^^^^^^^
INTERNALERROR> File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 182, in parse_item
INTERNALERROR> raise should_never_reach_here(
INTERNALERROR> NotImplementedError: Unexpected pytest node (see printed output).
========================= 71 tests collected in 0.07s ==========================
Traceback (most recent call last):
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/run_adapter.py", line 18, in <module>
main(tool, cmd, subargs, toolargs)
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/__main__.py", line 96, in main
parents, result = run(toolargs, **subargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/adapter/pytest/_discovery.py", line 42, in discover
raise Exception(f"pytest discovery failed (exit code {ec})")
Exception: pytest discovery failed (exit code 3)
at ChildProcess.<anonymous> (/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/src/client/common/process/rawProcessApis.ts:151:29)
at Object.onceWrapper (node:events:633:26)
at ChildProcess.emit (node:events:518:28)
at ChildProcess.emit (node:domain:489:12)
at maybeClose (node:internal/child_process:1104:16)
at Socket.<anonymous> (node:internal/child_process:456:11)
at Socket.emit (node:events:518:28)
at Socket.emit (node:domain:489:12)
at Pipe.<anonymous> (node:net:343:12)
at Pipe.callbackTrampoline (node:internal/async_hooks:130:17)
2024-12-27 18:22:04.844 [debug] Found cached env for /u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/bin/python
2024-12-27 18:22:41.199 [debug] Found cached env for /u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/bin/python
2024-12-27 18:23:54.624 [debug] Found cached env for /u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/bin/python
2024-12-27 18:23:54.625 [info] Running installed packages checker: {
id: '/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/bin/python',
sysPrefix: '/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12',
envType: 'Poetry',
envName: 'myproject-ido50-uZ-py3.12',
envPath: '/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12',
path: '/u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/bin/python',
architecture: 3,
sysVersion: '3.12.4 (main, Aug 1 2024, 08:33:17) [Clang 15.0.0 (clang-1500.3.9.4)]',
version: {
raw: '3.12.4',
major: 3,
minor: 12,
patch: 4,
build: [],
prerelease: [ 'final', '0' ]
},
displayName: "Python 3.12.4 ('myproject-ido50-uZ-py3.12')",
detailedDisplayName: "Python 3.12.4 ('myproject-ido50-uZ-py3.12': Poetry)",
type: 'Virtual'
} /u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/installed_check.py /u/ks/src/myproject/pyproject.toml
2024-12-27 18:23:54.625 [info] > ~/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/bin/python ~/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/installed_check.py ./pyproject.toml
2024-12-27 18:23:54.631 [debug] Found cached env for /u/ks/Library/Caches/pypoetry/virtualenvs/myproject-ido50-uZ-py3.12/bin/python
2024-12-27 18:23:54.732 [debug] Installed packages check result:
[]
Extension version: 2024.22.1
VS Code version: Code 1.96.2 (fabdb6a30b49f79a7aba0f2ad9df9b399473380f, 2024-12-19T10:22:47.216Z)
OS version: Darwin arm64 23.4.0
Modes:
- Python version (& distribution if applicable, e.g. Anaconda): 3.12.4
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Poetry
- Value of the
python.languageServer
setting: Default
User Settings
venvPath: "<placeholder>"
languageServer: "Pylance"
testing
• pytestEnabled: true
• unittestEnabled: true
terminal
• activateEnvironment: false
experiments
• enabled: false
• optInto: ["pythonTestAdapter"]
Installed Extensions
Extension Name | Extension Id | Version |
---|---|---|
Auto Add Brackets in String Interpolation | aliariff.auto-add-brackets | 0.12.2 |
autopep8 | ms-python.autopep8 | 2024.0.0 |
AWS Toolkit | amazonwebservices.aws-toolkit-vscode | 3.40.0 |
Better Jinja | samuelcolvin.jinjahtml | 0.20.0 |
Binary Plist | dnicolson.binary-plist | 0.11.4 |
Character Count | stevensona.character-count | 0.1.1 |
chmod | dlech.chmod | 1.1.1 |
Code Runner | formulahendry.code-runner | 0.12.2 |
CodeSnap | adpyke.codesnap | 1.3.4 |
Color Vision | wilsonsio.color-vision | 0.1.0 |
Coverage Gutters | ryanluker.vscode-coverage-gutters | 2.12.0 |
Dash | deerawan.vscode-dash | 2.4.0 |
DeepSource Autofix™ AI | DeepSourceCorp.deepsource-vscode | 1.6.19 |
Docker | ms-azuretools.vscode-docker | 1.29.3 |
Easy Snippet | inu1255.easy-snippet | 0.7.5 |
Edit CSV | janisdd.vscode-edit-csv | 0.11.1 |
ESLint | dbaeumer.vscode-eslint | 3.0.10 |
Even Better TOML | tamasfe.even-better-toml | 0.21.2 |
File Utils | sleistner.vscode-fileutils | 3.10.3 |
Flake8 | ms-python.flake8 | 2023.10.0 |
GitHub Copilot | GitHub.copilot | 1.254.0 |
GitHub Copilot Chat | GitHub.copilot-chat | 0.23.2 |
GitLens — Git supercharged | eamodio.gitlens | 16.1.1 |
HashiCorp Terraform | hashicorp.terraform | 2.34.2 |
Increment Selection | albymor.increment-selection | 0.2.0 |
IntelliCode | VisualStudioExptTeam.vscodeintellicode | 1.3.2 |
IntelliCode API Usage Examples | VisualStudioExptTeam.intellicode-api-usage-examples | 0.2.9 |
JavaScript Debugger | ms-vscode.js-debug | 1.96.0 |
JavaScript Debugger Companion Extension | ms-vscode.js-debug-companion | 1.1.3 |
JSON formatter | ClemensPeters.format-json | 1.0.3 |
Jupyter | ms-toolsai.jupyter | 2024.11.0 |
Jupyter Cell Tags | ms-toolsai.vscode-jupyter-cell-tags | 0.1.9 |
Jupyter Keymap | ms-toolsai.jupyter-keymap | 1.1.2 |
Jupyter Notebook Renderers | ms-toolsai.jupyter-renderers | 1.0.21 |
Jupyter Slide Show | ms-toolsai.vscode-jupyter-slideshow | 0.1.6 |
Live Preview | ms-vscode.live-server | 0.4.15 |
Live Share | ms-vsliveshare.vsliveshare | 1.0.5941 |
Markdown Editor | zaaack.markdown-editor | 0.1.12 |
Material Icon Theme | PKief.material-icon-theme | 5.16.0 |
MDX | unifiedjs.vscode-mdx | 1.8.12 |
MongoDB for VS Code | mongodb.mongodb-vscode | 1.11.0 |
New Moon Syntax Theme | taniarascia.new-moon-vscode | 1.8.8 |
Notes | dionmunk.vscode-notes | 1.2.1 |
Open in SourceTree | morrislaptop.vscode-open-in-sourcetree | 0.6.0 |
Prettier - Code formatter | esbenp.prettier-vscode | 11.0.0 |
Prettify JSON | mohsen1.prettify-json | 0.0.3 |
Project Templates | cantonios.project-templates | 1.2.0 |
Pylance | ms-python.vscode-pylance | 2024.12.1 |
Python | ms-python.python | 2024.22.1 |
Python Debugger | ms-python.debugpy | 2024.14.0 |
Selected Character Count | mousetraps.selected-character-count | 0.0.1 |
shell-format | foxundermoon.shell-format | 7.2.5 |
Table Visualizer for JavaScript Profiles | ms-vscode.vscode-js-profile-table | 1.0.10 |
Toggle Quotes | BriteSnow.vscode-toggle-quotes | 0.3.6 |
TypeScript Toolbox | DSKWRK.vscode-generate-getter-setter | 0.5.0 |
VSCode Aider | Apertia.vscode-aider | 1.0.5 |
undefined | oderwat.indent-rainbow | 8.3.1 |
YAML | redhat.vscode-yaml | 1.15.0 |
YAML Sort | PascalReitermann93.vscode-yaml-sort | 6.6.0 |
System Info
Item | Value |
---|---|
CPUs | Apple M3 Pro (11 x 2400) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: enabled_on direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_graphite: disabled_off video_decode: enabled video_encode: enabled webgl: enabled webgl2: enabled webgpu: enabled webnn: disabled_off |
Load (avg) | 2, 2, 2 |
Memory (System) | 18.00GB (0.05GB free) |
Process Argv | . |
Screen Reader | no |
VM | 0% |
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
kassi commentedon Dec 29, 2024
@karthiknadig I downgraded to 2024.22.0 and then to 2024.20.0 but my problem still exists with any version. I don't think it's related to the issue you linked.
I don't see a buffer overflow either.
I did some digging and debugging into the extension code and compared it with my output:
and
fullname
is fetched via_get_location
fromitem
anditem.location
contains onlyit_raises_a_value_error
as third element. So to me it looks as if pytest discovery in this case doesn't deliver the required fullname, but some short name only.Thus I believe it rather has something to do with
pytest-describe
and the extension not being able to determine them correctly.WDYT? And would you mind reopening again?
Thanks
WellingtonNico commentedon Dec 30, 2024
@kassi
after downgraded vscode-python extension, I also needed to clone my project to a new folder to get it working again, don't know why, I even upgraded the version again to check if it could be solved only doing this and I needed to clone into a new folder again(also downgrade again), give it a try.
eleanorjboyd commentedon Jan 6, 2025
Hi! It looks like you still aren't on the experiment. In your logs it mentions
File "/u/ks/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/testing_tools/run_adapter.py", line 18, in <module>
and that file is part of our old design. If you move"python.experiments.optInto": ["pythonTestAdapter"],
into your user settings file then that should fix this issue. Let me know if not- thanks!kassi commentedon Jan 9, 2025
@eleanorjboyd I already have this setting in my global settings, and I also added it to the
.vscode/settings.json
inside the project. As I mentioned earliereleanorjboyd commentedon Jan 9, 2025
Do you have the setting:
"telemetry.telemetryLevel": "off",
This comment brought up that removing it helped and wondering if this is connected: #24214 (comment).
kassi commentedon Jan 12, 2025
@eleanorjboyd yes, and I tried removing it incl. other telemetry related configs, but same result.
However while doing that another setting caught my eye, which is
"python.experiments.enabled": false
which was misaligned in the config (really need a way to auto sort this yaml file). I set it totrue
, quit and reopened, and got another error message, saying that pytest is somehow out of sync and I need to reload the window.I figured out I need to set it up again via "Python: Configure tests", do a "DevelopeR: Reload window" and finally I see the tests in the sidebar.
This also works after switching back to the old telemetry off setting (and quitting and reopening vscode).
The only thing I realize is that in my pretty new project, where I have 2 test files, it takes some seconds to show the tests. So I did the same in another repo with some more tests (12 test files with a total of 89 tests). It shows all
<Function it_...>
tests in the Output in an info log, but doesn't show anything in the sidebar - it's actually still processing after minutes and doesn't come back. After updating to the latest version from Python extension again this also works.Thanks for your assistance.