Skip to content

installing pytest-cov causes all usage of pytest to fail #458

@djhenderson

Description

@djhenderson

Summary

After installing pytest-cov, previously working pytest usage now fails. Uninstalling pytest-cov allows pytest to run properly.

Expected vs actual result

Running pytest without any coverage options should work the same with and without pytest-cov installed. This is the result after I uninstalled pytest-cov.

> py -m pytest -x --capture=sys debug_tools\symbol_test.py
================================================= test session starts =================================================
platform win32 -- Python 3.9.2, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: D:\Users\Doug\dosprogs\DebugFix
collected 0 items

================================================ no tests ran in 0.05s ================================================

Reproducer

I have python 3.9.2 installed for all users.

In an admin terminal window I did py -m pip install -U pytest.

In an admin terminal window I did py -m pip install -U pytest-cov.

In a user terminal window I did py -m pytest -x --capture=sys debug_tools\symbol_test.py.

Versions

> ver
Microsoft Windows [Version 10.0.19042.868]

> py --version
Python 3.9.2

> pytest --version
pytest 6.2.2

Config

I have none of these files tox.ini, pytest.ini, .coveragerc, setup.cfg .

Code

I wrote the skeleton for a unit test.

# debug_tools/symbol_test.py

from . symbol import *
import pytest
class TestValue:
    pass
class TestHexU8:
    pass
class TestHexu16:
    pass
class TestSymbol:
    pass
class TestSymbolTable:
    pass

After no response for several moments, I pressed Ctrl-C,

> py -m pytest -x --capture=sys debug_tools\symbol_test.py
Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\tempfile.py", line 251, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
PermissionError: [Errno 13] Permission denied: 'C:\\Program Files\\Python39\\lib\\site-packages\\pytest_cov\\__pycache__\\tmp_b69qocx'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
<snips>
  File "C:\Program Files\Python39\lib\tempfile.py", line 251, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
KeyboardInterrupt
^C

Note:

> set T
TEMP=C:\Users\Doug\AppData\Local\Temp
TMP=C:\Users\Doug\AppData\Local\Temp

It looks like the pip install of pytest-cov did not compile the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions