我跟踪了HeadyPython2Edition,第4章演示了pep8遵从性测试。
在运行py.test -Pep8 searchV.py时,会出现错误
appdata\local\programs\python\python38\lib\site-packages\pep8.py:110: FutureWarning:可能嵌套在位置1 EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[({ {x []}),;]‘) ===============test会话启动========================================= platform win32 -Python3.8.6,pytest-6.2.1,py-1.10.0,EXTRANEOUS_WHITESPACE_REGEX-0.13.1 rootdir: d:\work\py-模块插件: pep8-1.0.6 收集了0项/1错误。
======================================================= ===============错误_______________ERROR收集测试会话____直接构造Pep8Item已被废弃,请使用Pep8Item.from_parent。有关更多详细信息,请参阅https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent。==========short测试摘要资料===============错误中断:1收集期间的错误
以下是serachV.py中的代码
def search_letter(phrase: str , letter:str='aeiou')->set:
""" Serach for letter in phrase"""
return set(letter).intersection(set(phrase))不知道为什么没有收集物品?
发布于 2021-01-16 06:42:40
尝试了pep8 searchV.py而不是py.test --pep8 searchV.py,它起了作用。
但是pep8已经改名为pycodestyle (GitHub问题#466)。pep8工具的使用将在以后的版本中删除。
所以,我用了pycodestyle,它起作用了!
pycodestyle searchV.pyhttps://stackoverflow.com/questions/65713241
复制相似问题