Skip to content

ImportError: Error importing plugin "vscode_pytest": No module named 'vscode_pytest' #24414

@talebia

Description

@talebia

similar to 23192 I'm using python 3.10.10 and below are the logs:

2024-11-11 12:17:09.161 [debug] Testing: Manually triggered test refresh
2024-11-11 12:17:09.161 [debug] Testing: Clearing all discovered tests
2024-11-11 12:17:09.161 [debug] Testing: Forcing test data refresh
2024-11-11 12:17:09.161 [debug] Testing: Refreshing all test data
2024-11-11 12:17:09.161 [debug] Found cached env for C:\Python\python.exe
2024-11-11 12:17:09.162 [info] Discover tests for workspace name: compute.rhino3d - uri: c:\dev\MyProject\MySolution
2024-11-11 12:17:09.162 [info] Running discovery for pytest using the new test adapter.
2024-11-11 12:17:09.162 [debug] Found cached env for C:\Python\python.exe
2024-11-11 12:17:09.163 [debug] Starting Test Discovery named pipe
2024-11-11 12:17:09.163 [debug] Creating named pipe server on \\.\pipe\python-test-discovery-a96448a0ff04d34aa1ac-sock
2024-11-11 12:17:09.165 [warning] The cwd resolves to a different path, checking if it has a symbolic link somewhere in its path.
2024-11-11 12:17:09.166 [info] All environment variables set for pytest discovery: {"ALLUSERSPROFILE":"C:\\ProgramData","APPDATA":"C:\\Users\\USER.NAME\\AppData\\Roaming","TEST_RUN_PIPE":"\\\\.\\pipe\\python-test-discovery-a96448a0ff04d34aa1ac-sock"}
2024-11-11 12:17:09.166 [debug] could not find a pixi interpreter for the interpreter at C:\Python\python.exe
2024-11-11 12:17:09.207 [debug] Activation Commands received undefined for shell cmd, resource c:\dev\MyProject\MySolution and interpreter C:\Python\python.exe
2024-11-11 12:17:09.219 [debug] Running pytest discovery with command: -m pytest -p vscode_pytest --collect-only myco_tests/bdd_tests for workspace c:\dev\MyProject\MySolution.
2024-11-11 12:17:09.219 [info] > C:\Python\python.exe -m pytest -p vscode_pytest --collect-only myco_tests/bdd_tests
2024-11-11 12:17:09.219 [info] cwd: .
2024-11-11 12:17:09.746 [error] Traceback (most recent call last):
  File "C:\Python\lib\site-packages\_pytest\config\__init__.py", line 864, in import_plugin
    __import__(importspec)
ModuleNotFoundError: No module named 'vscode_pytest'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "runpy.py", line 196, in _run_module_as_main
  File "runpy.py", line 86, in _run_code
  File "C:\Python\lib\site-packages\pytest\__main__.py", line 7, in <module>
    raise SystemExit(pytest.console_main())
  File "C:\Python\lib\site-packages\_pytest\config\__init__.py", line 206, in console_main
    code = main()
  File "C:\Python\lib\site-packages\_pytest\config\__init__.py", line 159, in main
    config = _prepareconfig(args, plugins)
  File "C:\Python\lib\site-packages\_pytest\config\__init__.py", line 346, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
  File "C:\Python\lib\site-packages\pluggy\_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "C:\Python\lib\site-packages\pluggy\_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "C:\Python\lib\site-packages\pluggy\_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "C:\Python\lib\site-packages\pluggy\_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
  File "C:\Python\lib\site-packages\_pytest\helpconfig.py", line 106, in pytest_cmdline_parse
    config = yield
  File "C:\Python\lib\site-packages\pluggy\_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "C:\Python\lib\site-packages\_pytest\config\__init__.py", line 1151, in pytest_cmdline_parse
    self.parse(args)
  File "C:\Python\lib\site-packages\_pytest\config\__init__.py", line 1500, in parse
    self._preparse(args, addopts=addopts)
  File "C:\Python\lib\site-packages\_pytest\config\__init__.py", line 1383, in _preparse
    self.pluginmanager.consider_preparse(args, exclude_only=False)
  File "C:\Python\lib\site-packages\_pytest\config\__init__.py", line 794, in consider_preparse
    self.consider_pluginarg(parg)
  File "C:\Python\lib\site-packages\_pytest\config\__init__.py", line 817, in consider_pluginarg
    self.import_plugin(arg, consider_entry_points=True)
  File "C:\Python\lib\site-packages\_pytest\config\__init__.py", line 866, in import_plugin
    raise ImportError(
  File "C:\Python\lib\site-packages\_pytest\config\__init__.py", line 864, in import_plugin
    __import__(importspec)
ImportError: Error importing plugin "vscode_pytest": No module named 'vscode_pytest'

2024-11-11 12:17:09.769 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace c:\dev\MyProject\MySolution.
2024-11-11 12:17:09.769 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace c:\dev\MyProject\MySolution. Creating and sending error discovery payload
2024-11-11 12:17:09.769 [error] pytest test discovery error for workspace:  c:\dev\MyProject\MySolution 
  
 The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace c:\dev\MyProject\MySolution
2024-11-11 12:25:13.769 [debug] Found cached env for C:\Python\python.exe
2024-11-11 12:25:13.769 [debug] Found cached env for C:\Python\python.exe
2024-11-11 12:29:49.793 [debug] Found cached env for C:\Python\python.exe
2024-11-11 12:29:54.937 [debug] Received shell integration sequence for powershell
2024-11-11 12:30:00.154 [debug] Found cached env for C:\Python\python.exe
2024-11-11 12:30:00.154 [debug] Selected python for [c:\dev\MyProject\MySolution] is [global] type: C:\Python\python.exe
2024-11-11 12:30:00.178 [debug] Extension unknown accessed getActiveEnvironmentPath with args: undefined
2024-11-11 12:30:00.178 [debug] Extension unknown accessed resolveEnvironment with args: {"id":"C:\\PYTHON\\PYTHON.EXE","path":"C:\\Python\\python.exe"}
2024-11-11 12:30:05.043 [debug] Received shell integration sequence for powershell
2024-11-11 12:30:11.862 [debug] Found cached env for C:\Python\python.exe
2024-11-11 12:30:11.863 [debug] Selected python for [c:\dev\MyProject\MySolution] is [global] type: C:\Python\python.exe
2024-11-11 12:30:11.893 [debug] Extension unknown accessed resolveEnvironment with args: {"id":"C:\\PYTHON\\PYTHON.EXE","path":"C:\\Python\\python.exe"}
2024-11-11 12:30:11.893 [debug] Extension unknown accessed getActiveEnvironmentPath with args: undefined
2024-11-11 12:30:11.919 [debug] Received shell integration sequence for powershell
2024-11-11 12:31:14.693 [debug] Found cached env for C:\Python\python.exe

Similarly can get around it by using something like this but not sustainable.

Metadata

Metadata

Assignees

Labels

area-testinginfo-neededIssue requires more information from postertriage-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