问题描述:
在安装pytest的过程中:
如果安装顺序是这样的:
安装:pytest和pytest-parallel
然后运行代码,就会发生如下报错:
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/home/shengguowei/anaconda3/envs/NPU/lib/python3.9/site-packages/_pytest/main.py", line 266, in wrap_session
INTERNALERROR> config._do_configure()
INTERNALERROR> File "/home/shengguowei/anaconda3/envs/NPU/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1037, in _do_configure
INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR> File "/home/shengguowei/anaconda3/envs/NPU/lib/python3.9/site-packages/pluggy/_hooks.py", line 277, in call_historic
INTERNALERROR> res = self._hookexec(self.name, self.get_hookimpls(), kwargs, False)
INTERNALERROR> File "/home/shengguowei/anaconda3/envs/NPU/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> File "/home/shengguowei/anaconda3/envs/NPU/lib/python3.9/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/home/shengguowei/anaconda3/envs/NPU/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/home/shengguowei/anaconda3/envs/NPU/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/home/shengguowei/anaconda3/envs/NPU/lib/python3.9/site-packages/pytest_parallel/__init__.py", line 111, in pytest_configure
INTERNALERROR> config.pluginmanager.register(ParallelRunner(config), 'parallelrunner')
INTERNALERROR> File "/home/shengguowei/anaconda3/envs/NPU/lib/python3.9/site-packages/pytest_parallel/__init__.py", line 196, in __init__
INTERNALERROR> self._log = py.log.Producer('pytest-parallel')
INTERNALERROR> AttributeError: module 'py' has no attribute 'log'
这个时候我们pip install py,对自带的py进行一个升级,覆盖掉这个内建的py即可。