Python testing with flake8 and pytest results in AttributeError: 'Application' object has no attribute 'parse_preliminary_options_and_args'

Python testing with flake8 and pytest results in AttributeError: 'Application' object has no attribute 'parse_preliminary_options_and_args'

今天我 运行 测试时,出现以下错误:

    return self._hookexec(self, self.get_hookimpls(), kwargs)
ve/lib/python2.7/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
ve/lib/python2.7/site-packages/pluggy/manager.py:87: in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
ve/lib/python2.7/site-packages/_pytest/runner.py:123: in pytest_runtest_call
    item.runtest()
ve/lib/python2.7/site-packages/pytest_flake8.py:126: in runtest
    self.statistics)
ve/lib/python2.7/site-packages/py/_io/capture.py:150: in call
    res = func(*args, **kwargs)
ve/lib/python2.7/site-packages/pytest_flake8.py:191: in check_file
    app.parse_preliminary_options_and_args(args)
E   AttributeError: 'Application' object has no attribute 'parse_preliminary_options_and_args'

我正在使用

        'pytest',
        'pytest-cov',
        'pytest-flake8',
        'pytest-flask',
        'pytest-watch',

库的版本递增:pytest (4.6.9 -> 4.6.10)、pyflakes (2.1.1 -> 2.2.0)、pycodestyle (2.5.0 -> 2.6.0) 和 flake8 (3.7.9 -> 3.8.0)。变更日志中没有关于 parse_preliminary_options_and_args 属性的内容。我猜这与 flake8 弃用 setuptools 集成有关: python setup.py flake8 (setuptools integration) is now deprecated and will be removed in a future version (See also GitLab!330, GitLab#544)

将 flake8 固定到 3.7.9 修复了错误,但如果不反复试验,我将如何解决这个问题?

为什么这不能给出更好的错误?

pytest-flake8 正在使用 flake8 的私有 api,因此当我们更改 flake8 3.8.0 中的实现细节时它损坏了

还有更多详细信息here or the issue with pytest-flake8 here


免责声明:我是当前的 flake8 维护者