Skip to content

[v2024.4.0] Error importing plugin "vscode_pytest": cannot import name 'Literal' from 'typing' [Py3.7] #23179

Description

Behaviour

Cant load / run any pytests tests in v2024.4.0

Can see the breaking change coming in here:
v2024.2.1...v2024.4.0#diff-9a28b4b19fbb6331c15c76b4752852162785c0d521038cb637d8432901ebead2R13

should be importing from typing_extensions

Steps to reproduce:

  1. Try to run / load any pytest tests

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Traceback (most recent call last):
  File "c:\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\pytest\__main__.py", line 5, in <module>
    raise SystemExit(pytest.console_main())
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\_pytest\config\__init__.py", line 192, in console_main
    code = main()
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\_pytest\config\__init__.py", line 150, in main
    config = _prepareconfig(args, plugins)
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\_pytest\config\__init__.py", line 332, in _prepareconfig
    pluginmanager=pluginmanager, args=args
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\pluggy\_hooks.py", line 433, in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\pluggy\_manager.py", line 112, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\pluggy\_callers.py", line 133, in _multicall
    teardown[0].send(outcome)
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\_pytest\helpconfig.py", line 104, in pytest_cmdline_parse
    config: Config = outcome.get_result()
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\pluggy\_result.py", line 108, in get_result
    raise exc.with_traceback(exc.__traceback__)
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\pluggy\_callers.py", line 80, in _multicall
    res = hook_impl.function(*args)
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\_pytest\config\__init__.py", line 1075, in pytest_cmdline_parse
    self.parse(args)
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\_pytest\config\__init__.py", line 1425, in parse
    self._preparse(args, addopts=addopts)
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\_pytest\config\__init__.py", line 1301, in _preparse
    self.pluginmanager.consider_preparse(args, exclude_only=False)
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\_pytest\config\__init__.py", line 709, in consider_preparse
    self.consider_pluginarg(parg)
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\_pytest\config\__init__.py", line 735, in consider_pluginarg
    self.import_plugin(arg, consider_entry_points=True)
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\_pytest\config\__init__.py", line 785, in import_plugin
    ).with_traceback(e.__traceback__) from e
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\_pytest\config\__init__.py", line 781, in import_plugin
    __import__(importspec)
  File "C:\Users\mhuisman\envs\3.7\lib\site-packages\_pytest\assertion\rewrite.py", line 178, in exec_module
    exec(co, module.__dict__)
  File "c:\Users\mhuisman\.vscode\extensions\ms-python.python-2024.4.0\python_files\vscode_pytest\__init__.py", line 13, in <module>
    from typing import Any, Dict, List, Optional, Union, Literal, TypedDict  # noqa: E402
ImportError: Error importing plugin "vscode_pytest": cannot import name 'Literal' from 'typing' (c:\python37\lib\typing.py)

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage-neededNeeds assignment to the proper sub-team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions