Skip to content

NoSource exception is failing to import for earlier coverage versions  #24607

@GeorgeNikitinNV

Description

@GeorgeNikitinNV

Type: Bug

Behaviour

Run Tests with Coverage fails in VSCode.

Traceback (most recent call last):
  File "[USER_HOME_PATH]/.vscode/extensions/ms-python.python-2024.22.0-darwin-arm64/python_files/vscode_pytest/run_pytest_script.py", line 64, in <module>
    pytest.main(arg_array)
  File "[PACKGE_PATH]/lib/python3.9/site-packages/_pytest/config/__init__.py", line 175, in main
    ret: ExitCode | int = config.hook.pytest_cmdline_main(config=config)
  File "[PACKGE_PATH]/lib/python3.9/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "[PACKGE_PATH]/lib/python3.9/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "[PACKGE_PATH]/lib/python3.9/site-packages/pluggy/_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "[PACKGE_PATH]/lib/python3.9/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "[PACKGE_PATH]/lib/python3.9/site-packages/_pytest/main.py", line 330, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "[PACKGE_PATH]/lib/python3.9/site-packages/_pytest/main.py", line 318, in wrap_session
    config.hook.pytest_sessionfinish(
  File "[PACKGE_PATH]/lib/python3.9/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "[PACKGE_PATH]/lib/python3.9/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "[PACKGE_PATH]/lib/python3.9/site-packages/pluggy/_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "[PACKGE_PATH]/lib/python3.9/site-packages/pluggy/_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
  File "[PACKGE_PATH]/lib/python3.9/site-packages/_pytest/logging.py", line 868, in pytest_sessionfinish
    return (yield)
  File "[PACKGE_PATH]/lib/python3.9/site-packages/pluggy/_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
  File "[PACKGE_PATH]/lib/python3.9/site-packages/_pytest/terminal.py", line 893, in pytest_sessionfinish
    result = yield
  File "[PACKGE_PATH]/lib/python3.9/site-packages/pluggy/_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
  File "[PACKGE_PATH]/lib/python3.9/site-packages/_pytest/warnings.py", line 141, in pytest_sessionfinish
    return (yield)
  File "[PACKGE_PATH]/lib/python3.9/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "[USER_HOME_PATH]/.vscode/extensions/ms-python.python-2024.22.0-darwin-arm64/python_files/vscode_pytest/__init__.py", line 445, in pytest_sessionfinish
    from coverage import exceptions
ImportError: cannot import name 'exceptions' from 'coverage' ([PACKGE_PATH]/lib/python3.9/site-packages/coverage/__init__.py)

Steps to reproduce:

  1. Install python 2024.22.0 extension and Python Testing plugin.
  2. pip install coverage==5.5
  3. Run tests with coverage from testing plugin/

Diagnostic data

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

XXX

Extension version: 2024.22.0
VS Code version: Code 1.96.0 (138f619c86f1199955d53b4166bef66ef252935c, 2024-12-11T02:29:09.626Z)
OS version: Darwin arm64 23.5.0
Modes:

System Info
Item Value
CPUs Apple M2 Pro (12 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 3, 5, 5
Memory (System) 32.00GB (0.08GB free)
Process Argv --crash-reporter-id b0cbcaff-9225-44f7-9e5d-85e506c8203e
Screen Reader no
VM 0%

Metadata

Metadata

Assignees

Labels

area-testingbugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions