Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pytest Failing with new Release (4.1.0) #4606

Closed
chgad opened this issue Jan 6, 2019 · 5 comments
Closed

Pytest Failing with new Release (4.1.0) #4606

chgad opened this issue Jan 6, 2019 · 5 comments

Comments

@chgad
Copy link

chgad commented Jan 6, 2019

Hello everybody,

I encounter that my Travis CI Build fails with the latest (2 hours old) Release of pytest 4.1.0.

The Error i get, for each Test, looks like this :

self = <pytest_cov.plugin.CovPlugin object at 0x2af7e0d326a0>
item = <Function test_model_existence>
    @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'
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/pytest_cov/plugin.py:289: AttributeError

My conftest.py consists only of these 4 fixtures:

import pytest
from api.models import User, Contract, Shift, Report


@pytest.fixture
def user_model_class():
    return User


@pytest.fixture
def contract_model_class():
    return Contract


@pytest.fixture
def shift_model_class():
    return Shift


@pytest.fixture
def report_model_class():
    return Report

Finally we run the following command in Travis pipenv run pytest --cov=./

I do not believe that the Tests i run with those fixtures are explicitly relevant for this Error so i only describe what i do with them: I basically call hasattr(), isinstance() or issubclass() and a few basic assert A == B calls.

I allready looked into the Changelog and the docs if something corresponding to this error has changed but couldn't find anything. From this point i could only speculate that the new Release breakes something with the pytest_cov Plugin (or visversa).

Any help on how to get this working is appreciated.

Thanks in advance.

@nicoddemus
Copy link
Member

Hi @chgad thanks for the report! We are really sorry about this breakage.

We have removed item.get_marker, users should use item.get_closest_marker now (it's a long history, this was not an arbitrary change). Indeed I suspect pytest-cov might need to be updated.

cc @ionelmc

@ionelmc
Copy link
Member

ionelmc commented Jan 6, 2019

Ah yes, I'll make a quick release today or tomorrow.

@nicoddemus
Copy link
Member

Cool, thanks for the quick response!

@blueyed
Copy link
Contributor

blueyed commented Jan 6, 2019

Closing in favor of pytest-dev/pytest-cov#252.

@blueyed blueyed closed this as completed Jan 6, 2019
@chgad
Copy link
Author

chgad commented Jan 6, 2019

Thank you very much guys, especially for the quick response.

kaiwalyajoshi added a commit to mesosphere/dcos-commons that referenced this issue Jan 16, 2019
…d upstream as mentioned here: pytest-dev/pytest#4606 (comment)

Quoted here incase that link breaks in the future:
        "We have removed item.get_marker, users should use item.get_closest_marker now
        (it's a long history, this was not an arbitrary change). Indeed I suspect
        pytest-cov might need to be updated."

item.get_marker was removed in this PR pytest-dev/pytest#4564
kaiwalyajoshi added a commit to mesosphere/dcos-commons that referenced this issue Feb 21, 2019
…d upstream as mentioned here: pytest-dev/pytest#4606 (comment)

Quoted here incase that link breaks in the future:
        "We have removed item.get_marker, users should use item.get_closest_marker now
        (it's a long history, this was not an arbitrary change). Indeed I suspect
        pytest-cov might need to be updated."

item.get_marker was removed in this PR pytest-dev/pytest#4564
kaiwalyajoshi added a commit to mesosphere/dcos-commons that referenced this issue Feb 22, 2019
* Replace item.get_marker with item.get_closest_marker as it was removed upstream as mentioned here: pytest-dev/pytest#4606 (comment)

Quoted here incase that link breaks in the future:
        "We have removed item.get_marker, users should use item.get_closest_marker now
        (it's a long history, this was not an arbitrary change). Indeed I suspect
        pytest-cov might need to be updated."

item.get_marker was removed in this PR pytest-dev/pytest#4564

* Determine security mode of the cluster by querying the cluster instead of a local environment-variable.

* Remove underscores from services names, this breaks for scenarios such as 'nonessential_tasks' where underscores are not allowed in task names.

* Update frameworks/helloworld/tests/scale/test_scale.py

Co-Authored-By: kaiwalyajoshi <kjoshi@mesosphere.com>

* Address comments from code-review

* Add support for soack configuration and custom service names, this can be used to differentiate the various hello-worlds. ie --service-name='orchestration/hello-world'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants