Skip to content

pytest gives "Coverage disabled via --no-cov switch!" warning even --no-cov is not given!! #284

@iamabigstone

Description

@iamabigstone
  • a detailed description of the bug or suggestion
    I have not set --no-cov in any cli or configs, but it is given me the warning "Coverage disabled via --no-cov switch!". Even worse, I have enabled coverage in pytest.ini:
[pytest]
addopts = --cov=mypackage -vvv -s

But coverage is not running!

Here is output:

(ENV) $ python -m pytest
=================================================== test session starts ====================================================
platform darwin -- Python 2.7.15, pytest-4.4.1, py-1.8.0, pluggy-0.9.0 -- /Users/local/myrepo_new/ENV/bin/python
cachedir: .pytest_cache
rootdir: /Users/local/myrepo_new, inifile: pytest.ini
plugins: cov-2.6.1
collected 1 item                                                                                                           

test/test_myrepo.py::test_x PASSED
WARNING: Coverage disabled via --no-cov switch!

===================================================== warnings summary =====================================================
ENV/lib/python2.7/site-packages/pytest_cov/plugin.py:253
  /Users/local/myrepo_new/ENV/lib/python2.7/site-packages/pytest_cov/plugin.py:253: PytestWarning: Coverage disabled via --no-cov switch!
    warnings.warn(pytest.PytestWarning(message))

-- Docs: https://docs.pytest.org/en/latest/warnings.html
=========================================== 1 passed, 1 warnings in 0.03 seconds ===========================================
  • output of pip list from the virtual environment you are using
(ENV)$ pip list
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Package        Version
-------------- -------
atomicwrites   1.3.0  
attrs          19.1.0 
coverage       4.5.3  
funcsigs       1.0.2  
more-itertools 5.0.0  
pathlib2       2.3.3  
pip            19.1   
pluggy         0.9.0  
py             1.8.0  
pytest         4.4.1  
pytest-cov     2.6.1  
scandir        1.10.0 
setuptools     41.0.1 
six            1.12.0 
wheel          0.33.1 
  • pytest and operating system versions
(ENV) $ pytest --version
This is pytest version 4.4.1, imported from /Users/local/myrepo_new/ENV/lib/python2.7/site-packages/pytest.pyc
setuptools registered plugins:
  pytest-cov-2.6.1 at /Users/local/myrepo_new/ENV/lib/python2.7/site-packages/pytest_cov/plugin.py
(ENV)$ plutil -p /System/Library/CoreServices/SystemVersion.plist
{
  "iOSSupportVersion" => "12.0"
  "ProductBuildVersion" => "18D25"
  "ProductCopyright" => "1983-2018 Apple Inc."
  "ProductName" => "Mac OS X"
  "ProductUserVisibleVersion" => "10.14.3"
  "ProductVersion" => "10.14.3"
}

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