Closed proofit404 closed 5 years ago
$ pytest --flake8 ============================= test session starts ============================== platform linux -- Python 3.7.1, pytest-4.1.1, py-1.7.0, pluggy-0.8.1 cachedir: .tox/flake8/.pytest_cache rootdir: /home/travis/build/dry-python/dependencies, inifile: pytest.ini plugins: isort-0.2.1, flake8-1.0.2, black-0.3.2, celery-4.2.1 collecting 216 items / 3 skipped INTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "/home/travis/build/dry-python/dependencies/.tox/flake8/lib/python3.7/site-packages/_pytest/main.py", line 203, in wrap_session INTERNALERROR> session.exitstatus = doit(config, session) or 0 INTERNALERROR> File "/home/travis/build/dry-python/dependencies/.tox/flake8/lib/python3.7/site-packages/_pytest/main.py", line 242, in _main INTERNALERROR> config.hook.pytest_collection(session=session) INTERNALERROR> File "/home/travis/build/dry-python/dependencies/.tox/flake8/lib/python3.7/site-packages/pluggy/hooks.py", line 284, in __call__ INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs) INTERNALERROR> File "/home/travis/build/dry-python/dependencies/.tox/flake8/lib/python3.7/site-packages/pluggy/manager.py", line 68, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/home/travis/build/dry-python/dependencies/.tox/flake8/lib/python3.7/site-packages/pluggy/manager.py", line 62, in <lambda> INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False, INTERNALERROR> File "/home/travis/build/dry-python/dependencies/.tox/flake8/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "/home/travis/build/dry-python/dependencies/.tox/flake8/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result INTERNALERROR> raise ex[1].with_traceback(ex[2]) INTERNALERROR> File "/home/travis/build/dry-python/dependencies/.tox/flake8/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "/home/travis/build/dry-python/dependencies/.tox/flake8/lib/python3.7/site-packages/_pytest/main.py", line 252, in pytest_collection INTERNALERROR> return session.perform_collect() INTERNALERROR> File "/home/travis/build/dry-python/dependencies/.tox/flake8/lib/python3.7/site-packages/_pytest/main.py", line 468, in perform_collect INTERNALERROR> session=self, config=self.config, items=items INTERNALERROR> File "/home/travis/build/dry-python/dependencies/.tox/flake8/lib/python3.7/site-packages/pluggy/hooks.py", line 284, in __call__ INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs) INTERNALERROR> File "/home/travis/build/dry-python/dependencies/.tox/flake8/lib/python3.7/site-packages/pluggy/manager.py", line 68, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/home/travis/build/dry-python/dependencies/.tox/flake8/lib/python3.7/site-packages/pluggy/manager.py", line 62, in <lambda> INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False, INTERNALERROR> File "/home/travis/build/dry-python/dependencies/.tox/flake8/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "/home/travis/build/dry-python/dependencies/.tox/flake8/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result INTERNALERROR> raise ex[1].with_traceback(ex[2]) INTERNALERROR> File "/home/travis/build/dry-python/dependencies/.tox/flake8/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "/home/travis/build/dry-python/dependencies/tests/conftest.py", line 8, in pytest_collection_modifyitems INTERNALERROR> items[:] = [item for item in items if item.get_marker(linter)] INTERNALERROR> File "/home/travis/build/dry-python/dependencies/tests/conftest.py", line 8, in <listcomp> INTERNALERROR> items[:] = [item for item in items if item.get_marker(linter)] INTERNALERROR> AttributeError: 'Flake8Item' object has no attribute 'get_marker' ==================== 3 skipped, 1 warnings in 0.56 seconds =====================
So this is not an issue with pytest-flake8, but that pytest itself removed the function get_marker. Their suggested fix is to use get_closest_marker instead.
get_marker
get_closest_marker
Thanks! My bad.