pytest: AttributeError: 'Function' object has no attribute 'get_marker'
============= test session starts ===========
platform linux -- Python 3.6.6, pytest-4.0.2, py-1.7.0, pluggy-0.8.0 -- 
plugins: monkeytype-1.0.1, cov-2.6.0
Tests work if I pin pytest to this version. Updating to 4.1.0 breaks with this error:
platform linux -- Python 3.6.6, pytest-4.1.0, py-1.7.0, pluggy-0.8.0 -- 
plugins: monkeytype-1.0.1, cov-2.6.0
...
self = <pytest_cov.plugin.CovPlugin object at 0x7f13154272b0>, item = <Function test_part_compilation[PP]>
    @compat.hookwrapper
    def pytest_runtest_call(self, item):
>       if (item.get_marker('no_cover')
                or 'no_cover' in getattr(item, 'fixturenames', ())):
E               AttributeError: 'Function' object has no attribute 'get_marker'
/home/mbarkhau/miniconda3/envs/pycalver_py36/lib/python3.6/site-packages/pytest_cov/plugin.py:289: AttributeError
I can reproduce the error and provide more information in case it isn’t immediately clear what the issue is.
About this issue
- Original URL
 - State: closed
 - Created 5 years ago
 - Reactions: 6
 - Comments: 21 (10 by maintainers)
 
Commits related to this issue
- Pin pytest to older version because of bug Issue: https://github.com/pytest-dev/pytest/issues/4608 — committed to cprovencher/dcos by cprovencher 5 years ago
 - Bump pytest-cov version due to this https://github.com/pytest-dev/pytest/issues/4608 — committed to persephone-tools/persephone by shuttle1987 5 years ago
 - Update Dockerfile to include pytest Spesific version is used because of the error I got. https://github.com/pytest-dev/pytest/issues/4608 — committed to yagmurdalman/sposm by yagmurdalman 5 years ago
 - Ensure "pytest-remotedata>=0.3.1" to resolve error Errors: > remote_data = item.get_marker('remote_data') E AttributeError: 'Function' object has no attribute 'get_marker' REF: ... — committed to LSSTDESC/snmachine by tallamjr 4 years ago
 - Ensure "pytest-remotedata>=0.3.1" to resolve error Errors: > remote_data = item.get_marker('remote_data') E AttributeError: 'Function' object has no attribute 'get_marker' REF: ... — committed to LSSTDESC/snmachine by tallamjr 4 years ago
 
UPDATE: I was able to bypass the error by reverting to pytest 3.x:
NOTE: I’m using anaconda.
I’m using
pytest-cov2.8.1 and still get the error.Edit: Updating
pytest-remotedata==0.3.0topytest-remotedata==0.3.2solved the problem for me. Anaconda dist on Windows 10 but I updated usingpip, notcondacov-2.6.1 should fix this.