Repository navigation
unexpected situation while processing a pytest node during test discovery #19804
Copy link
Copy link
Closed
Labels
area-testingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugverification-neededVerification of issue is requestedVerification of issue is requestedverifiedVerification succeededVerification succeeded
Milestone
Description
Type: Bug
Behaviour
Expected vs. Actual
Expect the extension to discover pytest test functions. Instead, it reports an "unexpected situation".
Steps to reproduce:
- Enable pytest testing.
- Point test discovery at a specific test module by specifying a relative path with
"python.testing.pytestArgs": ["test/unit/test_baseline.py"]. - Run "Refresh Tests" command.
Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.9.6
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
- Value of the
python.languageServersetting: Default
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
Sanitized Python extension output:
> ./venv/fireball/bin/python3 ~/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir . -s --cache-clear test/unit/test_baseline.py
cwd: .
[ERROR 2022-8-8 16:59:23.15]: Error discovering pytest tests:
[n [Error]: ============================= test session starts ==============================
platform linux -- Python 3.9.6, pytest-5.4.3, py-1.11.0, pluggy-0.13.1
rootdir: /home/ /local/gitRepos/fireball
plugins: cov-2.5.1
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_baseline_trace
extra info:
fileid:
traceback:
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/run_adapter.py", line 22, in <module>
main(tool, cmd, subargs, toolargs)
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/__main__.py", line 99, in main
parents, result = run(toolargs, **subargs)
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 30, in discover
ec = _pytest_main(pytestargs, [_plugin])
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/_pytest/config/__init__.py", line 124, in main
ret = config.hook.pytest_cmdline_main(
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/_pytest/main.py", line 240, in pytest_cmdline_main
return wrap_session(config, _main)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/_pytest/main.py", line 191, in wrap_session
session.exitstatus = doit(config, session) or 0
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/_pytest/main.py", line 246, in _main
config.hook.pytest_collection(session=session)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/_pytest/main.py", line 257, in pytest_collection
return session.perform_collect()
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/_pytest/main.py", line 454, in perform_collect
hook.pytest_collection_modifyitems(
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 92, in pytest_collection_modifyitems
test, parents = self.parse_item(item)
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 77, in parse_item
return parse_item(item)
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 173, in parse_item
(nodeid, parents, fileid, testfunc, parameterized) = _parse_node_id(
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 144, in <lambda>
_parse_node_id=(lambda *a: _parse_node_id(*a)),
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 396, in _parse_node_id
testid, name, kind = next(nodes)
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 460, in _iter_nodes
nodeid, testid = _normalize_test_id(testid, kind)
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 455, in <lambda>
_normalize_test_id=(lambda *a: _normalize_test_id(*a)),
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 526, in _normalize_test_id
raise should_never_reach_here(
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 132, in should_never_reach_here
traceback.print_stack()
collected 1 item
<Module test_baseline.py>
<Function test_baseline_trace>
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_baseline_trace
extra info:
fileid:
traceback:
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/run_adapter.py", line 22, in <module>
main(tool, cmd, subargs, toolargs)
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/__main__.py", line 99, in main
parents, result = run(toolargs, **subargs)
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 30, in discover
ec = _pytest_main(pytestargs, [_plugin])
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/_pytest/config/__init__.py", line 124, in main
ret = config.hook.pytest_cmdline_main(
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/_pytest/main.py", line 240, in pytest_cmdline_main
return wrap_session(config, _main)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/_pytest/main.py", line 191, in wrap_session
session.exitstatus = doit(config, session) or 0
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/_pytest/main.py", line 246, in _main
config.hook.pytest_collection(session=session)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/_pytest/main.py", line 257, in pytest_collection
return session.perform_collect()
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/_pytest/main.py", line 458, in perform_collect
hook.pytest_collection_finish(session=self)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 107, in pytest_collection_finish
test, parents = self.parse_item(item)
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 77, in parse_item
return parse_item(item)
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 173, in parse_item
(nodeid, parents, fileid, testfunc, parameterized) = _parse_node_id(
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 144, in <lambda>
_parse_node_id=(lambda *a: _parse_node_id(*a)),
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 396, in _parse_node_id
testid, name, kind = next(nodes)
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 460, in _iter_nodes
nodeid, testid = _normalize_test_id(testid, kind)
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 455, in <lambda>
_normalize_test_id=(lambda *a: _normalize_test_id(*a)),
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 526, in _normalize_test_id
raise should_never_reach_here(
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 132, in should_never_reach_here
traceback.print_stack()
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/_pytest/main.py", line 454, in perform_collect
INTERNALERROR> hook.pytest_collection_modifyitems(
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 92, in pytest_collection_modifyitems
INTERNALERROR> test, parents = self.parse_item(item)
INTERNALERROR> File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 77, in parse_item
INTERNALERROR> return parse_item(item)
INTERNALERROR> File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 173, in parse_item
INTERNALERROR> (nodeid, parents, fileid, testfunc, parameterized) = _parse_node_id(
INTERNALERROR> File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 144, in <lambda>
INTERNALERROR> _parse_node_id=(lambda *a: _parse_node_id(*a)),
INTERNALERROR> File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 396, in _parse_node_id
INTERNALERROR> testid, name, kind = next(nodes)
INTERNALERROR> File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 460, in _iter_nodes
INTERNALERROR> nodeid, testid = _normalize_test_id(testid, kind)
INTERNALERROR> File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 455, in <lambda>
INTERNALERROR> _normalize_test_id=(lambda *a: _normalize_test_id(*a)),
INTERNALERROR> File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 526, 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/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/_pytest/main.py", line 191, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/_pytest/main.py", line 246, in _main
INTERNALERROR> config.hook.pytest_collection(session=session)
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/_pytest/main.py", line 257, in pytest_collection
INTERNALERROR> return session.perform_collect()
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/_pytest/main.py", line 458, in perform_collect
INTERNALERROR> hook.pytest_collection_finish(session=self)
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/home/timTheEnchanter/local/gitRepos/fireball/venv/fireball/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 107, in pytest_collection_finish
INTERNALERROR> test, parents = self.parse_item(item)
INTERNALERROR> File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 77, in parse_item
INTERNALERROR> return parse_item(item)
INTERNALERROR> File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 173, in parse_item
INTERNALERROR> (nodeid, parents, fileid, testfunc, parameterized) = _parse_node_id(
INTERNALERROR> File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 144, in <lambda>
INTERNALERROR> _parse_node_id=(lambda *a: _parse_node_id(*a)),
INTERNALERROR> File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 396, in _parse_node_id
INTERNALERROR> testid, name, kind = next(nodes)
INTERNALERROR> File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 460, in _iter_nodes
INTERNALERROR> nodeid, testid = _normalize_test_id(testid, kind)
INTERNALERROR> File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 455, in <lambda>
INTERNALERROR> _normalize_test_id=(lambda *a: _normalize_test_id(*a)),
INTERNALERROR> File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 526, in _normalize_test_id
INTERNALERROR> raise should_never_reach_here(
INTERNALERROR> NotImplementedError: Unexpected pytest node (see printed output).
============================ no tests ran in 1.35s =============================
Traceback (most recent call last):
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/run_adapter.py", line 22, in <module>
main(tool, cmd, subargs, toolargs)
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/__main__.py", line 99, in main
parents, result = run(toolargs, **subargs)
File "/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 44, in discover
raise Exception("pytest discovery failed (exit code {})".format(ec))
Exception: pytest discovery failed (exit code 3)
at ChildProcess.<anonymous> (/home/timTheEnchanter/.vscode-server/extensions/ms-python.python-2022.14.0/out/client/extension.js:2:240364)
at Object.onceWrapper (node:events:646:26)
at ChildProcess.emit (node:events:526:28)
at maybeClose (node:internal/child_process:1092:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)]
User Settings
languageServer: "Pylance"
testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true
terminal
• activateEnvironment: false
Extension version: 2022.14.0
VS Code version: Code 1.71.0 (784b0177c56c607789f9638da7b6bf3230d47a8c, 2022-09-01T07:25:38.437Z)
OS version: Darwin x64 21.6.0
Modes:
Sandboxed: No
Remote OS version: Linux x64 3.10.0-957.1.3.el7.x86_64
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411cf:30557515
vsaa593:30376534
pythonvs932:30410667
cppdebug:30492333
pylanb8912:30545647
vsclangdc:30486549
c4g48928:30535728
hb751961:30553087
dsvsc012cf:30540253
azure-dev_surveyone:30548225
i497e931:30553904
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-testingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugverification-neededVerification of issue is requestedVerification of issue is requestedverifiedVerification succeededVerification succeeded
Activity
karthiknadig commentedon Sep 9, 2022
csgehman Can you provide the test code that generated this? also, could you share your test settings?
csgehman commentedon Sep 12, 2022
The code is not public. Here's a sanitized version of test_baseline.py:
I'm not sure what you mean by "test settings". Here are the
python.testingthings in my settings.json:I just noticed the extraneous
,in this JSON, but removing it doesn't appear to have any impact.eleanorjboyd commentedon Dec 14, 2022
Hello, this looks to be a bug in the test adapter and is likely related to the ongoing buggy behavior on pytest discovery and running in vscode. We are currently work on a rewrite of how pytest works in vscode and hope this rewrite will fix this and similar bugs. The main issue which will be working on is here: #17242, and progress will be updated on this issue. Thank you!
plafosse commentedon Jan 9, 2023
Are there any known workarounds, I've been wanting to use this feature since it came out but its never been able to discover the tests.
eleanorjboyd commentedon Jan 10, 2023
Peter LaFosse (@plafosse), could you provide more information on your situation specifically? Since it is a general error code I am not sure any workarounds unless I see what more specifically you are running into. Settings and logs would be helpful to diagnose- thanks!
eleanorjboyd commentedon Jun 22, 2023
Hello! We have just finished our testing rewrite and are beginning the roll out to users. I have tested this issue with the re-write and I am no longer reproducing the bug! If you would like to try it yourself, you need to be on vscode insiders and then add this setting to your users
settings.json"python.experiments.optInto": ["pythonTestAdapter"]. We are in the process of switching all users to the rewrite but are doing so incrementally so if you do not have insiders, watch our release notes to get updated on when it will begin to hit stable. Let me know if it doesn’t work for you and we can re-open this issue. Thanks!eleanorjboyd commentedon Jun 26, 2023
verification steps same as repro steps:
"python.experiments.optInto": ["pythonTestAdapter"],example for what could be in your test file:
rzhao271 commentedon Jun 28, 2023
The Refresh Tests command does nothing for me. I added the setting to my User settings file. Am I supposed to press the Configure Python Tests button first? There's also a single info log that shows up saying that it's discovering tests, but no trace or debug logs seem to appear after.
macOS
Python extension v2023.11.11791005
Edit: I just noticed I didn't enable the pytestEnabled setting. Will see if that fixes it.
rzhao271 commentedon Jun 28, 2023
The extension discovered the test in
test/unit/test_easy.pynow, but I got stuck a few times.python.testing.pytestEnabledtotrue.I'm guessing the usual flow is to press the "Configure Python Tests" button, still? I feel like I took a much more manual approach this time.
eleanorjboyd commentedon Jun 28, 2023
Hi! Sorry for the ongoing confusion. Yes, it will work best to do
Configure Python Testsas this will set thepython.testing.pytestEnabledtotrue. The current flow we think for our users is they have a repo with tests or just wrote them, they click on the test explorer icon, follow the prompts to setup their testing withConfigure Python Teststhen discovery should work. By the time they get to the test explorer we expect them to already have pytest installed since they will be using it in their workspace already or have it listed as a dependency. Hope this clarification helps and let me know what is still confusing you as I am thinking about how to update this flow in the future and would love any input. Thanks!