坑:pytest 运行报错unknown hook 'pytest_namespace' in plugin

右键运行pytest run时报错,原因是pytest版本过高导致的。有时候会遇到在自己本机没问题,拉取服务器代码下来后就出问题了,所以把pytest版本改低就可以,亲测有效,希望对你有帮助

完整报错信息如下:

plugins: allure-adaptor-1.7.10, forked-1.0.2, html-1.20.0, metadata-1.8.0, xdist-1.29.0
collected 17 items / 1 errors / 16 selected
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\_pytest\main.py", line 213, in wrap_
session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\_pytest\main.py", line 256, in _main

INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "e:\python3\python3.7.332\lib\site-packages\pluggy\hooks.py

你可能感兴趣的:(测试,python)