asmeurer/pytest-flakes

Seemingly broken with pytest 3.7.0

sigmavirus24 opened this issue · 5 comments

================================================ 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

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

Is this still an issue?

@asmeurer I cannot reproduce with pytest-flakes 4.0.0

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