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>