You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OS Version: Win 11 23H2 in WSL 2 with Ubuntu 24.04.1 LTS
Steps to Reproduce:
Create a new Python project (I used uv init example ; uv venv but I also tested without uv).
Add a test_something.py file with a function in it starting with 'test_' in the name.
Add a launch configuration for python files and a configure tests to use pytest.
Activate the .venv
Install pytest with uv add pytest.
Ctrl+shift+T and refresh tests hoping to discover my tests. After a while it shows the directory I put the test in or the project directory, but none of the tests under it, as though they are invisible.
Python Output right after refreshing tests: > 2024-12-30 22:58:55.768 [info] > ./.venv/bin/python ~/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/run_adapter.py discover pytest -- --rootdir . -s --cache-clear test
2024-12-30 22:58:55.768 [info] cwd: .
If I specify the full path to the function e.g. "test/test_mything.py::test_a_my_thing" or even "test/test_mything.py" I get a massive trace which it asks me to raise an issue for:
platform linux -- Python 3.12.3, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/ruser/dev/projects/example
configfile: ../../../../../mnt/c/Users/redacted/OneDrive - REDACTED/Dev/projects/example/pyproject.toml
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: ::test_a_my_thing
extra info:
fileid:
traceback:
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/run_adapter.py", line 18, in <module>
main(tool, cmd, subargs, toolargs)
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/__main__.py", line 96, in main
parents, result = run(toolargs, **subargs)
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_discovery.py", line 29, in discover
ec = _pytest_main(pytestargs, [_plugin])
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 175, in main
ret: ExitCode | int = config.hook.pytest_cmdline_main(config=config)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/main.py", line 330, in pytest_cmdline_main
return wrap_session(config, _main)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/main.py", line 283, in wrap_session
session.exitstatus = doit(config, session) or 0
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/main.py", line 336, in _main
config.hook.pytest_collection(session=session)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/main.py", line 347, in pytest_collection
session.perform_collect()
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/main.py", line 812, in perform_collect
hook.pytest_collection_modifyitems(
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_discovery.py", line 86, in pytest_collection_modifyitems
test, parents = self.parse_item(item)
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_discovery.py", line 71, in parse_item
return parse_item(item)
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 171, in parse_item
(nodeid, parents, fileid, testfunc, parameterized) = _parse_node_id(item.nodeid, kind)
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 142, in <lambda>
_parse_node_id=(lambda *a: _parse_node_id(*a)),
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 387, in _parse_node_id
testid, name, kind = next(nodes)
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 451, in _iter_nodes
nodeid, testid = _normalize_test_id(testid, kind)
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 446, in <lambda>
_normalize_test_id=(lambda *a: _normalize_test_id(*a)),
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 517, in _normalize_test_id
raise should_never_reach_here(
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 130, in should_never_reach_here
traceback.print_stack()
collected 1 item
<Dir example>
<Dir test>
<Module test_mything.py>
<Function test_a_my_thing>
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: ::test_a_my_thing
extra info:
fileid:
traceback:
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/run_adapter.py", line 18, in <module>
main(tool, cmd, subargs, toolargs)
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/__main__.py", line 96, in main
parents, result = run(toolargs, **subargs)
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_discovery.py", line 29, in discover
ec = _pytest_main(pytestargs, [_plugin])
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 175, in main
ret: ExitCode | int = config.hook.pytest_cmdline_main(config=config)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/main.py", line 330, in pytest_cmdline_main
return wrap_session(config, _main)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/main.py", line 283, in wrap_session
session.exitstatus = doit(config, session) or 0
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/main.py", line 336, in _main
config.hook.pytest_collection(session=session)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/main.py", line 347, in pytest_collection
session.perform_collect()
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/main.py", line 819, in perform_collect
hook.pytest_collection_finish(session=self)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_discovery.py", line 101, in pytest_collection_finish
test, parents = self.parse_item(item)
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_discovery.py", line 71, in parse_item
return parse_item(item)
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 171, in parse_item
(nodeid, parents, fileid, testfunc, parameterized) = _parse_node_id(item.nodeid, kind)
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 142, in <lambda>
_parse_node_id=(lambda *a: _parse_node_id(*a)),
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 387, in _parse_node_id
testid, name, kind = next(nodes)
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 451, in _iter_nodes
nodeid, testid = _normalize_test_id(testid, kind)
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 446, in <lambda>
_normalize_test_id=(lambda *a: _normalize_test_id(*a)),
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 517, in _normalize_test_id
raise should_never_reach_here(
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/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 "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/main.py", line 812, in perform_collect
INTERNALERROR> hook.pytest_collection_modifyitems(
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/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 "/home/ruser/dev/projects/example/.venv/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 "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> raise exception.with_traceback(exception.__traceback__)
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/cacheprovider.py", line 443, in pytest_collection_modifyitems
INTERNALERROR> res = yield
INTERNALERROR> ^^^^^
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/cacheprovider.py", line 373, in pytest_collection_modifyitems
INTERNALERROR> res = yield
INTERNALERROR> ^^^^^
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_discovery.py", line 86, in pytest_collection_modifyitems
INTERNALERROR> test, parents = self.parse_item(item)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_discovery.py", line 71, in parse_item
INTERNALERROR> return parse_item(item)
INTERNALERROR> ^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 171, in parse_item
INTERNALERROR> (nodeid, parents, fileid, testfunc, parameterized) = _parse_node_id(item.nodeid, kind)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 142, in <lambda>
INTERNALERROR> _parse_node_id=(lambda *a: _parse_node_id(*a)),
INTERNALERROR> ^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 387, in _parse_node_id
INTERNALERROR> testid, name, kind = next(nodes)
INTERNALERROR> ^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 451, in _iter_nodes
INTERNALERROR> nodeid, testid = _normalize_test_id(testid, kind)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 446, in <lambda>
INTERNALERROR> _normalize_test_id=(lambda *a: _normalize_test_id(*a)),
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 517, in _normalize_test_id
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 "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/main.py", line 283, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/main.py", line 336, in _main
INTERNALERROR> config.hook.pytest_collection(session=session)
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/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 "/home/ruser/dev/projects/example/.venv/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 "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> raise exception.with_traceback(exception.__traceback__)
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/logging.py", line 790, in pytest_collection
INTERNALERROR> return (yield)
INTERNALERROR> ^^^^^
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/warnings.py", line 121, in pytest_collection
INTERNALERROR> return (yield)
INTERNALERROR> ^^^^^
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1417, in pytest_collection
INTERNALERROR> return (yield)
INTERNALERROR> ^^^^^
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/main.py", line 347, in pytest_collection
INTERNALERROR> session.perform_collect()
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/_pytest/main.py", line 819, in perform_collect
INTERNALERROR> hook.pytest_collection_finish(session=self)
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/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 "/home/ruser/dev/projects/example/.venv/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 "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> raise exception.with_traceback(exception.__traceback__)
INTERNALERROR> File "/home/ruser/dev/projects/example/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_discovery.py", line 101, in pytest_collection_finish
INTERNALERROR> test, parents = self.parse_item(item)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_discovery.py", line 71, in parse_item
INTERNALERROR> return parse_item(item)
INTERNALERROR> ^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 171, in parse_item
INTERNALERROR> (nodeid, parents, fileid, testfunc, parameterized) = _parse_node_id(item.nodeid, kind)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 142, in <lambda>
INTERNALERROR> _parse_node_id=(lambda *a: _parse_node_id(*a)),
INTERNALERROR> ^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 387, in _parse_node_id
INTERNALERROR> testid, name, kind = next(nodes)
INTERNALERROR> ^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 451, in _iter_nodes
INTERNALERROR> nodeid, testid = _normalize_test_id(testid, kind)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 446, in <lambda>
INTERNALERROR> _normalize_test_id=(lambda *a: _normalize_test_id(*a)),
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/pytest/_pytest_item.py", line 517, in _normalize_test_id
INTERNALERROR> raise should_never_reach_here(
INTERNALERROR> NotImplementedError: Unexpected pytest node (see printed output).
========================== 1 test collected in 0.17s ===========================
Traceback (most recent call last):
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/run_adapter.py", line 18, in <module>
main(tool, cmd, subargs, toolargs)
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/adapter/__main__.py", line 96, in main
parents, result = run(toolargs, **subargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/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> (/home/ruser/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/out/client/extension.js:2:254172)
at Object.onceWrapper (node:events:633:26)
at ChildProcess.emit (node:events:518:28)
at maybeClose (node:internal/child_process:1104:16)
at ChildProcess._handle.onexit (node:internal/child_process:304:5)]
2024-12-30 23:07:21.964 [info] Discover tests for workspace name: example - uri: /home/ruser/dev/projects/example
2024-12-30 23:07:21.975 [info] > ./.venv/bin/python ~/.vscode-server/extensions/ms-python.python-2024.22.1-linux-x64/python_files/testing_tools/run_adapter.py discover pytest -- --rootdir . -s --cache-clear test/test_mything.py
2024-12-30 23:07:21.975 [info] cwd: .
2024-12-30 23:07:24.094 [error] Error discovering pytest tests:
[n [Error]: ============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/ruser/dev/projects/example
configfile: ../../../../../mnt/c/Users/redacted/<REDACTED>/Dev/projects/example/pyproject.toml
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: ::test_a_my_thing
extra info:
fileid:
The text was updated successfully, but these errors were encountered:
It could be an issue with your tests or you might also want to look at the below discussion on test discovery with the python extension breaking. Your error output cites the extension.
I tried downgrading the python extension progressively but it did not resolve my error. However, when I switched to the pre-release version my test was discovered 🎉
Returning to the release version and disabling A/B experiments in the settings also seems to work.
The test is definitely correct. It's just a function, like so (in ./test/test_mything.py):
Does this issue occur when all extensions are disabled?: Yes
VS Code Version:
OS Version: Win 11 23H2 in WSL 2 with Ubuntu 24.04.1 LTS
Steps to Reproduce:
uv init example ; uv venv
but I also tested without uv).uv add pytest
.If I specify the full path to the function e.g. "test/test_mything.py::test_a_my_thing" or even "test/test_mything.py" I get a massive trace which it asks me to raise an issue for:
The text was updated successfully, but these errors were encountered: