pytest: Regression in 3.7.0: AttributeError for _collectfile

I get AttributeError: 'FlakesItem' object has no attribute '_collectfile' when running devpi-server tests with tox (tox -e py27 is enough) since pytest 3.7.0. When I pin to pytest<3.7dev it works (using 3.6.4).

It seems to be related to the current working directory. The tox config switches to test_devpi_server. When I run pytest in server it’s fine, when i run in server/test_devpi_server it breaks.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (6 by maintainers)

Commits related to this issue

Most upvoted comments

In our team we’re suffering the same problem, we had to fix the pytest version to 3.6.4 to avoid this regression.

same all issues that are triggered by _collectfile missing on 3rd party items are due to this one its an entirely unintended issue

Same here with flake8:

$ py.test --flake8 package
=========================================================================================== test session starts ============================================================================================
platform darwin -- Python 3.6.2, pytest-3.7.0, py-1.5.3, pluggy-0.7.1
rootdir: /Users/Thomas/Work/stuff, inifile: setup.cfg
plugins: flake8-1.0.1, cov-2.5.1, hypothesis-3.57.0
collected 0 items / 1 errors                                                                                                                                                                               

================================================================================================== ERRORS ==================================================================================================
____________________________________________________________________________________________ ERROR collecting  _____________________________________________________________________________________________
../../../../.local/miniconda3/envs/test/lib/python3.6/site-packages/_pytest/runner.py:201: in __init__
    self.result = func()
../../../../.local/miniconda3/envs/test/lib/python3.6/site-packages/_pytest/runner.py:261: in <lambda>
    call = CallInfo(lambda: list(collector.collect()), "collect")
../../../../.local/miniconda3/envs/test/lib/python3.6/site-packages/_pytest/main.py:475: in collect
    for x in self._collect(arg):
../../../../.local/miniconda3/envs/test/lib/python3.6/site-packages/_pytest/main.py:519: in _collect
    for x in root._collectfile(pkginit):
E   AttributeError: 'Flake8Item' object has no attribute '_collectfile'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================================================= 1 error in 0.17 seconds ==========================================================================================