Reputation: 1375
I've followed Head First Python 2nd Edition and a pep8 compliance testing is demonstrated in chapter 4.
When running py.test --pep8 searchV.py gives error
appdata\local\programs\python\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.6, pytest-6.2.1, py-1.10.0, pluggy-0.13.1 rootdir: D:\work\py-modules plugins: pep8-1.0.6 collected 0 items / 1 error
=============== ERRORS ======================================================= _______________ERROR collecting test session ____ Direct construction of Pep8Item has been deprecated, please use Pep8Item.from_parent. See https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent for more details. ==========short test summary info =============== ERROR !!!!!!!!!!!!!!!!!!!!Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!
Here's the code in serachV.py
def search_letter(phrase: str , letter:str='aeiou')->set:
""" Serach for letter in phrase"""
return set(letter).intersection(set(phrase))
Not sure why no items are collected ?
Upvotes: 3
Views: 2476
Reputation: 1375
Tried pep8 searchV.py
instead of Instead of py.test --pep8 searchV.py
and it worked.
But pep8 has been renamed to pycodestyle (GitHub issue #466) . Use of the pep8 tool will be removed in a future release.
So , I used pycodestyle and it worked !
pycodestyle searchV.py
Upvotes: 6