执行UI自动化测试用例时发生的问题
/usr/local/bin/python3.11 /Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm/_jb_pytest_runner.py --path /Users/kwai1/kwaishopuiautotest/test_case/demo/test_my_first_demo.py
Testing started at 16:05 ...
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/py/_vendored_packages/apipkg/__init__.py", line 145, in __makeattr
modpath, attrname = self.__map__[name]
~~~~~~~~~~~~^^^^^^
KeyError: '__spec__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm/_jb_pytest_runner.py", line 5, in <module>
import pytest
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pytest/__init__.py", line 5, in <module>
from _pytest.assertion import register_assert_rewrite
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/_pytest/assertion/__init__.py", line 9, in <module>
from _pytest.assertion import rewrite
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/_pytest/assertion/rewrite.py", line 34, in <module>
from _pytest.assertion import util
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/_pytest/assertion/util.py", line 13, in <module>
import _pytest._code
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/_pytest/_code/__init__.py", line 2, in <module>
from .code import Code
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/_pytest/_code/code.py", line 54, in <module>
class Code:
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/_pytest/_code/code.py", line 81, in Code
def path(self) -> Union[py.path.local, str]:
^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/py/_vendored_packages/apipkg/__init__.py", line 152, in __makeattr
result = importobj(modpath, attrname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/py/_vendored_packages/apipkg/__init__.py", line 72, in importobj
module = __import__(modpath, None, None, ['__doc__'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1138, in _find_and_load_unlocked
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/py/_vendored_packages/apipkg/__init__.py", line 150, in __makeattr
raise AttributeError(name)
AttributeError: __spec__
进程已结束,退出代码1
空套件