Skip to content

Error "pytest-cov not installed" when running "Run Tests with Coverage" in the vscode interface #24802

@willianchan

Description

@willianchan

Type: Bug

Behaviour

When clicking the "Run Tests with Coverage" button, it shows: ERROR: pytest-cov is not installed, please install this before running pytest with coverage as pytest-cov is required.

Expected Behavior is running all the tests and sending code coverage file to the folder

Steps to reproduce:

The code can be cloned here: https://github.com/willianchan/pythontddalura

I am using:

  • python 3.13.2 with venv, requirements in the repo
  • vscode 1.97.0
  • Python Extension 2025.0.0

Image

Image

Diagnostic data

When clicking the "Run Tests with Coverage" button, it shows in the TEST RESULTS tab:

Running pytest with args: ['-p', 'vscode_pytest', '-v', '--rootdir=c:\\Users\\Chan\\Desktop\\Estudos\\TDD\\projeto-bytebank', '--cov=.', 'c:\\Users\\Chan\\Desktop\\Estudos\\TDD\\projeto-bytebank\\tests\\bytebank_test.py::TestClass::test_quando_idade_recebe_13_03_2000_deve_retornar_22', 'c:\\Users\\Chan\\Desktop\\Estudos\\TDD\\projeto-bytebank\\tests\\bytebank_test.py::TestClass::test_quando_sobrenome_recebe_nome_completo_deve_retornar_sobrenome']
Error[vscode-pytest]: unable to read testIds from temp file
 
ERROR: pytest-cov is not installed, please install this before running pytest with coverage as pytest-cov is required. 

Traceback (most recent call last):
  File "c:\Users\Chan\.vscode\extensions\ms-python.python-2025.0.0-win32-x64\python_files\vscode_pytest\run_pytest_script.py", line 64, in <module>
    pytest.main(arg_array)
    ~~~~~~~~~~~^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\_pytest\config\__init__.py", line 156, in main
    config = _prepareconfig(args, plugins)
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\_pytest\config\__init__.py", line 341, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
        pluginmanager=pluginmanager, args=args
    )
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
    ~~~~~~~~~~~~~~^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\_pytest\helpconfig.py", line 105, in pytest_cmdline_parse
    config = yield
             ^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\_pytest\config\__init__.py", line 1140, in pytest_cmdline_parse
    self.parse(args)
    ~~~~~~~~~~^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\_pytest\config\__init__.py", line 1494, in parse
    self._preparse(args, addopts=addopts)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\_pytest\config\__init__.py", line 1398, in _preparse
    self.hook.pytest_load_initial_conftests(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        early_config=self, args=args, parser=self._parser
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
    ~~~~~~~~~~~~~~^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\_pytest\warnings.py", line 151, in pytest_load_initial_conftests
    return (yield)
            ^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
    ~~~~~~~~~~~~~~^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\_pytest\capture.py", line 154, in pytest_load_initial_conftests
    yield
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "c:\Users\Chan\.vscode\extensions\ms-python.python-2025.0.0-win32-x64\python_files\vscode_pytest\__init__.py", line 70, in pytest_load_initial_conftests
    raise VSCodePytestError(
        "\n \nERROR: pytest-cov is not installed, please install this before running pytest with coverage as pytest-cov is required. \n"
    )
vscode_pytest.VSCodePytestError: 
 
ERROR: pytest-cov is not installed, please install this before running pytest with coverage as pytest-cov is required. 


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\Chan\.vscode\extensions\ms-python.python-2025.0.0-win32-x64\python_files\vscode_pytest\run_pytest_script.py", line 67, in <module>
    run_pytest(args)
    ~~~~~~~~~~^^^^^^
  File "c:\Users\Chan\.vscode\extensions\ms-python.python-2025.0.0-win32-x64\python_files\vscode_pytest\run_pytest_script.py", line 23, in run_pytest
    pytest.main(arg_array)
    ~~~~~~~~~~~^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\_pytest\config\__init__.py", line 156, in main
    config = _prepareconfig(args, plugins)
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\_pytest\config\__init__.py", line 341, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
        pluginmanager=pluginmanager, args=args
    )
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
    ~~~~~~~~~~~~~~^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\_pytest\helpconfig.py", line 105, in pytest_cmdline_parse
    config = yield
             ^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\_pytest\config\__init__.py", line 1140, in pytest_cmdline_parse
    self.parse(args)
    ~~~~~~~~~~^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\_pytest\config\__init__.py", line 1494, in parse
    self._preparse(args, addopts=addopts)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\_pytest\config\__init__.py", line 1398, in _preparse
    self.hook.pytest_load_initial_conftests(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        early_config=self, args=args, parser=self._parser
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
    ~~~~~~~~~~~~~~^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\_pytest\warnings.py", line 151, in pytest_load_initial_conftests
    return (yield)
            ^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
    ~~~~~~~~~~~~~~^^^^^^^^^^^
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\_pytest\capture.py", line 154, in pytest_load_initial_conftests
    yield
  File "c:\Users\Chan\Desktop\Estudos\TDD\projeto-bytebank\venvtdd\Lib\site-packages\pluggy\_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "c:\Users\Chan\.vscode\extensions\ms-python.python-2025.0.0-win32-x64\python_files\vscode_pytest\__init__.py", line 70, in pytest_load_initial_conftests
    raise VSCodePytestError(
        "\n \nERROR: pytest-cov is not installed, please install this before running pytest with coverage as pytest-cov is required. \n"
    )
vscode_pytest.VSCodePytestError: 
 
ERROR: pytest-cov is not installed, please install this before running pytest with coverage as pytest-cov is required. 

Finished running tests!

Extension version: 2025.0.0
VS Code version: Code 1.97.0 (33fc5a94a3f99ebe7087e8fe79fbe1d37a251016, 2025-02-04T22:41:26.688Z)
OS version: Windows_NT x64 10.0.19045
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.13.2
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true

Installed Extensions
Extension Name Extension Id Version
autodocstring njp 0.6.1
ccs-flutter-color cir 2.0.0
copilot Git 1.266.0
copilot-chat Git 0.24.0
dart-code Dar 3.104.0
debugpy ms- 2025.0.0
flutter Dar 3.104.0
js-debug ms- 1.97.0
js-debug-companion ms- 1.1.3
live-server ms- 0.4.15
material-icon-theme PKi 5.19.0
python ms- 2025.0.0
vsc-python-indent Kev 1.19.0
vscode-coverage-gutters rya 2.13.0
vscode-js-profile-table ms- 1.0.10
vscode-pylance ms- 2025.2.1
vscode-yaml red 1.16.0
System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i5-12600K (16 x 3686)
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
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.78GB (7.60GB free)
Process Argv --crash-reporter-id 69f00565-e9b8-40a0-b501-e0f8ffb93f04
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dwnewjupytercf:31046870
nativerepl2:31139839
pythonrstrctxt:31112756
nativeloc2:31192216
iacca1:31171482
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530
6074i472:31201624
dwoutputs:31233690
hdaa2157:31222309
copilot_t_ci:31222730
jda6j935:31233686

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions