AttributeError: 'Function' object has no attribute 'get_marker'
See original GitHub issueI just started getting the following error with pytest-cov v2.6.0, pytest v4.1.0 on Python 3.4.6, PyPy, and PyPy3
self = <pytest_cov.plugin.CovPlugin object at 0x110f365c0>, item = <Function test_x>
@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'
../.pyenv/versions/3.4.9/envs/venv/lib/python3.4/site-packages/pytest_cov/plugin.py:289: AttributeError
How to replicate
-
Create a virtualenv with Python 3.4.9
-
pip install pytest==4.1.0 pytest-cov==2.6.0
-
Create
something.py
with the following contents:
def test_x():
assert True
- Run
pytest --cov=something something.py
Pytest output
========================================================== test session starts ===========================================================
platform darwin -- Python 3.4.9, pytest-4.1.0, py-1.7.0, pluggy-0.8.0 -- /Users/ross/.pyenv/versions/3.4.9/envs/venv/bin/python
cachedir: .pytest_cache
rootdir: /Users/ross/temp, inifile:
plugins: cov-2.6.0
collected 1 item
something.py::test_x FAILED [100%]
================================================================ FAILURES ================================================================
_________________________________________________________________ test_x _________________________________________________________________
self = <pytest_cov.plugin.CovPlugin object at 0x110f365c0>, item = <Function test_x>
@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'
../.pyenv/versions/3.4.9/envs/venv/lib/python3.4/site-packages/pytest_cov/plugin.py:289: AttributeError
---------- coverage: platform darwin, python 3.4.9-final-0 -----------
Name Stmts Miss Cover
----------------------------------
something.py 2 1 50%
======================================================== 1 failed in 0.07 seconds ========================================================
Issue Analytics
- State:
- Created 5 years ago
- Reactions:19
- Comments:21 (10 by maintainers)
Top Results From Across the Web
pytest AttributeError: 'Function' object has no attribute ' ...
Got this error on a very simple test using pytest version 4.6.3 . On searching, I came across this link where I found...
Read more >AttributeError: 'Function' object has no attribute 'get_marker' ...
Hi, I'm running into this issue with pytest version 4.3.0 (Python version 3.7.0). Please advise!
Read more >pytest AttributeError get_marker
AttributeError: 'Function' object has no attribute 'get_marker'. The fix requires update of affiliated pytest-* packages to at least:.
Read more >AttributeError: “Function”object has no attribute “get marker”
I have tried to follow the documentation but was not able to use urlparse.parse.quote_plus() in Python 3:from urllib.parse import urlparseparams ...
Read more >'function' object has no attribute 'get' while saving onetoone ...
I am getting : AttributeError: 'function' object has no attribute 'get' while saving onetoone relation in django?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
conda install pytest
;pip install pytest-remotedata>=0.3.1
and things start working.pytest-cov 2.6.1 is released.