Skip to content

should_never_reach_here for particular test case when parametrized test has unmatched brackets or parenthesis #17676

@ericmclachlan

Description

@ericmclachlan

Environment data

  • VS Code version: 1.62.0-insider
  • Extension version (available under the Extensions sidebar): Python v2021.10.1317843341
  • OS and version: Windows_NT x64 10.0.19043
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.0
  • Type of virtual environment used: N/A
  • Value of the python.languageServer setting: Pylance

Expected behaviour

Non-fatal test discovery.

Actual behaviour

Runtime error causes test discovery to fail.

Steps to reproduce:

@pytest.mark.parametrize("test_input,expected",
    [
		# Some tests,
        ("spaces](www", "spaces](www"),
		# Some other tests,
    ]
)
def test_remove_markdown_links(test_input, expected):
    # My implementation

Commenting out the above test case removes the symptoms of the bug.

Logs

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: ./deployment/tests/test_text_helper.py::test_remove_markdown_links[spaces](www-spaces](www]

traceback:
  File "/home/eric/.vscode-server/extensions/ms-python.python-2021.10.1317843341/pythonFiles/testing_tools/run_adapter.py", line 22, in <module>
    main(tool, cmd, subargs, toolargs)
  File "/home/eric/.vscode-server/extensions/ms-python.python-2021.10.1317843341/pythonFiles/testing_tools/adapter/__main__.py", line 100, in main
    parents, result = run(toolargs, **subargs)
  File "/home/eric/.vscode-server/extensions/ms-python.python-2021.10.1317843341/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 30, in discover
    ec = _pytest_main(pytestargs, [_plugin])
  File "/home/eric/.local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 162, in main
    ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
  File "/home/eric/.local/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/home/eric/.local/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/eric/.local/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/home/eric/.local/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/home/eric/.local/lib/python3.8/site-packages/_pytest/main.py", line 316, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "/home/eric/.local/lib/python3.8/site-packages/_pytest/main.py", line 269, in wrap_session
    session.exitstatus = doit(config, session) or 0
  File "/home/eric/.local/lib/python3.8/site-packages/_pytest/main.py", line 322, in _main
    config.hook.pytest_collection(session=session)
  File "/home/eric/.local/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/home/eric/.local/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/eric/.local/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/home/eric/.local/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/home/eric/.local/lib/python3.8/site-packages/_pytest/main.py", line 333, in pytest_collection
    session.perform_collect()
  File "/home/eric/.local/lib/python3.8/site-packages/_pytest/main.py", line 641, in perform_collect
    hook.pytest_collection_finish(session=self)
  File "/home/eric/.local/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/home/eric/.local/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/eric/.local/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/home/eric/.local/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/home/eric/.vscode-server/extensions/ms-python.python-2021.10.1317843341/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 107, in pytest_collection_finish
    test, parents = self.parse_item(item)
  File "/home/eric/.vscode-server/extensions/ms-python.python-2021.10.1317843341/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 77, in parse_item
    return parse_item(item)
  File "/home/eric/.vscode-server/extensions/ms-python.python-2021.10.1317843341/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 161, in parse_item
    (nodeid, parents, fileid, testfunc, parameterized) = _parse_node_id(
  File "/home/eric/.vscode-server/extensions/ms-python.python-2021.10.1317843341/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 144, in <lambda>
    _parse_node_id=(lambda *a: _parse_node_id(*a)),
  File "/home/eric/.vscode-server/extensions/ms-python.python-2021.10.1317843341/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 382, in _parse_node_id
    testid, name, kind = next(nodes)
  File "/home/eric/.vscode-server/extensions/ms-python.python-2021.10.1317843341/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 479, in _iter_nodes
    raise should_never_reach_here(
  File "/home/eric/.vscode-server/extensions/ms-python.python-2021.10.1317843341/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 132, in should_never_reach_here
    traceback.print_stack()

Metadata

Metadata

Assignees

Labels

area-testingbugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from poster

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions