首页 > 解决方案 > Pytest 不会运行任何测试

问题描述

我无法让 pytest 在 Python 3.6 上运行测试,因此我卸载并重新安装了 Python 3.7。然后我使用 pip 下载了 pytest 和 pep8 并添加了

C:\Users\CoolT\AppData\Local\Programs\Python\Python37-32\Scripts

到路径。现在我无法让 pytest 运行任何东西。

py.test并且python命令提示符命令不起作用,当我尝试运行测试时,会发生以下情况:

C:\Users\coolt\mymodules>py -3 -m pytest vsearch.py
C:\Users\coolt\AppData\Local\Programs\Python\Python37-32\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.7.2, pytest-4.1.1, py-1.7.0, pluggy-0.8.1
rootdir: C:\Users\coolt\mymodules, inifile:
plugins: pep8-1.0.6
collected 0 items

============================================ no tests ran in 0.18 seconds =============================================

关于如何解决我的问题的任何想法?

标签: pythonpippytestpep8

解决方案


我设法通过要求它进行 pep8 检查来运行测试。我在命令提示符下以管理员身份运行它:

py -3 -m pytest --pep8 vsearch.py


推荐阅读