py.test --pep8 vsearch.py报错解决办法

py.test --pep8 vsearch.py报错解决办法

使用pep8 vsearch.py替换py.test --pep8 vsearch.py即可。

pep8 has been renamed to pycodestyle (GitHub issue #466)
Use of the pep8 tool will be removed in a future release.
Please install and use `pycodestyle` instead.

$ pip install pycodestyle
$ pycodestyle ...

测试结果如下:
D:\PythonProjects\pythonstudy\ch04>py.test --pep8 vsearch22.py
d:\program files\python38\lib\site-packages\pep8.py:110: FutureWarning: Possible
 nested set at position 1
  EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
============================= test session starts =============================
platform win32 -- Python 3.8.10, pytest-7.1.3, pluggy-1.0.0
rootdir: D:\PythonProjects\pythonstudy\ch04
plugins: pep8-1.0.6
collected 0 items

============================ no tests ran in 0.04s ============================
ERROR: file or directory not found: vsearch22.py


D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>py.test --pep8 vsearch2.py
d:\program files\python38\lib\site-packages\pep8.py:110: FutureWarning: Possible
 nested set at position 1
  EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
============================= test session starts =============================
platform win32 -- Python 3.8.10, pytest-7.1.3, pluggy-1.0.0
rootdir: D:\PythonProjects\pythonstudy\ch04
plugins: pep8-1.0.6
collected 0 items / 1 error

=================================== ERRORS ====================================
________________________ ERROR collecting test session ________________________
Direct construction of pytest_pep8.Pep8Item has been deprecated, please use pyte
st_pep8.Pep8Item.from_parent.
See https://docs.pytest.org/en/stable/deprecations.html#node-construction-change
d-to-node-from-parent for more details.
=========================== short test summary info ===========================
ERROR
!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
============================== 1 error in 0.33s ===============================

D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>pytest --version
d:\program files\python38\lib\site-packages\pep8.py:110: FutureWarning: Possible
 nested set at position 1
  EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
pytest 7.1.3

D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>py -3 -m pytest pep8 vsearch2.py
D:\Program Files\Python38\lib\site-packages\pep8.py:110: FutureWarning: Possible
 nested set at position 1
  EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
============================= test session starts =============================
platform win32 -- Python 3.8.10, pytest-7.1.3, pluggy-1.0.0
rootdir: D:\PythonProjects\pythonstudy\ch04
plugins: pep8-1.0.6
collected 0 items

============================ no tests ran in 0.05s ============================
ERROR: file or directory not found: pep8


D:\PythonProjects\pythonstudy\ch04>py -3 -m pytest --pep8 vsearch2.py
D:\Program Files\Python38\lib\site-packages\pep8.py:110: FutureWarning: Possible
 nested set at position 1
  EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
============================= test session starts =============================
platform win32 -- Python 3.8.10, pytest-7.1.3, pluggy-1.0.0
rootdir: D:\PythonProjects\pythonstudy\ch04
plugins: pep8-1.0.6
collected 0 items / 1 error

=================================== ERRORS ====================================
________________________ ERROR collecting test session ________________________
Direct construction of pytest_pep8.Pep8Item has been deprecated, please use pyte
st_pep8.Pep8Item.from_parent.
See https://docs.pytest.org/en/stable/deprecations.html#node-construction-change
d-to-node-from-parent for more details.
=========================== short test summary info ===========================
ERROR
!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
============================== 1 error in 0.35s ===============================

D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>pep8 vsearch2.py
d:\program files\python38\lib\site-packages\pep8.py:110: FutureWarning: Possible
 nested set at position 1
  EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
d:\program files\python38\lib\site-packages\pep8.py:2123: UserWarning:

pep8 has been renamed to pycodestyle (GitHub issue #466)
Use of the pep8 tool will be removed in a future release.
Please install and use `pycodestyle` instead.

$ pip install pycodestyle
$ pycodestyle ...

  warnings.warn(
vsearch2.py:5:11: E225 missing whitespace around operator
vsearch2.py:9:31: E231 missing whitespace after ','
vsearch2.py:12:1: W391 blank line at end of file

D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>
D:\PythonProjects\pythonstudy\ch04>
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值