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

Seemingly broken with pytest 3.7.0 #21

Closed
sigmavirus24 opened this issue Jul 31, 2018 · 5 comments
Closed

Seemingly broken with pytest 3.7.0 #21

sigmavirus24 opened this issue Jul 31, 2018 · 5 comments

Comments

@sigmavirus24
Copy link

================================================ test session starts =================================================
platform darwin -- Python 3.6.3, pytest-3.7.0, py-1.5.2, pluggy-0.7.1
Django settings: settings (from environment variable)
rootdir: /Users/sigmavirus24/work/workproject, inifile: pytest.ini
plugins: tap-2.2, flakes-3.0.2, django-3.3.3, asyncio-0.9.0
collected 0 items / 1 errors

======================================================= ERRORS =======================================================
_________________________________________________ ERROR collecting  __________________________________________________
../../.virtualenvs/workproject/lib/python3.6/site-packages/_pytest/runner.py:201: in __init__
    self.result = func()
../../.virtualenvs/workproject/lib/python3.6/site-packages/_pytest/runner.py:261: in <lambda>
    call = CallInfo(lambda: list(collector.collect()), "collect")
../../.virtualenvs/workproject/lib/python3.6/site-packages/_pytest/main.py:475: in collect
    for x in self._collect(arg):
../../.virtualenvs/workproject/lib/python3.6/site-packages/_pytest/main.py:505: in _collect
    col = root._collectfile(pkginit)
E   AttributeError: 'FlakesItem' object has no attribute '_collectfile'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================== 1 error in 0.72 seconds ===============================================

This works fine with pytest 3.6.3

@bbengfort
Copy link

bbengfort commented Jul 31, 2018

Ah - I was literally just writing up an issue for this - thanks for posting it @sigmavirus24!

To add some context of my experience of the issue, I can run pytest against my tests with --flakes in setup.cfg and the tests will run; I encounter this error when I try to run a specific test file, e.g. pytest tests/test_mything.py.

Additionally, I had an error in my conftest.py doing custom pytest_itemcollected, FlakesItem has no attribute "obj". I managed to fix this particular issue by checking if the item was a FlakesItem instance and skipping it, but I imagine it's related to the bug.

For reference, our project and tests are at github.com/DistrictDataLabs/yellowbrick

bbengfort added a commit to DistrictDataLabs/yellowbrick that referenced this issue Jul 31, 2018
It appears that FlakesItems are not correct when updating to pytest
3.7.0 - this quick fix allows the conftest to ignore FlakesItems and
the global tests can be run, however running individual tests is still
broken.

A bug report has been submitted to pytest-flakes:

asmeurer/pytest-flakes#21
@fschulze
Copy link
Collaborator

See
pytest-dev/pytest#3742

@asmeurer
Copy link
Owner

Is this still an issue?

@bbengfort
Copy link

@asmeurer I cannot reproduce with pytest-flakes 4.0.0

@asmeurer
Copy link
Owner

asmeurer commented Aug 6, 2020

If anyone still sees this issue, please let me know here or open a new issue.

@asmeurer asmeurer closed this as completed Aug 6, 2020
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