先说一下背景,我在执行 test_xueqiu.py 的时候提示错误,错误信息贴在下面. 实在是百度不出来了,所以才来社区请教的.烦请各位前辈为小弟指点一下迷津




错误信息在下面:

Testing started at 1:42 ...
D:\python_workSpace\Appium\venv\Scripts\python3.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.2\helpers\pycharm_jb_pytest_runner.py" --target test_xueqiu.py::TestXueqiu.test_add
Launching pytest with arguments test_xueqiu.py::TestXueqiu::test_add in D:\python_workSpace\Appium\test_appium_po\test_case

============================= test session starts =============================
platform win32 -- Python 3.6.5, pytest-5.1.2, py-1.8.0, pluggy-0.12.0
rootdir: D:\python_workSpace\Appium\test_appium_po\test_case
plugins: allure-pytest-2.8.0
test_xueqiu.py:None (test_xueqiu.py)
ImportError while importing test module 'D:\python_workSpace\Appium\test_appium_po\test_case\test_xueqiu.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test_xueqiu.py:1: in
from test_appium_po.pages.main_page import MainPage
..\pages\main_page.py:4: in
from test_appium_po.pages.chose_page import ChosePage
..\pages\chose_page.py:2: in
from test_appium_po.pages.main_page import MainPage
E ImportError: cannot import name 'MainPage'
collected 0 items / 1 errors

=================================== ERRORS ====================================
_______________________ ERROR collecting test_xueqiu.py _______________________
ImportError while importing test module 'D:\python_workSpace\Appium\test_appium_po\test_case\test_xueqiu.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test_xueqiu.py:1: in
from test_appium_po.pages.main_page import MainPage
..\pages\main_page.py:4: in
from test_appium_po.pages.chose_page import ChosePage
..\pages\chose_page.py:2: in
from test_appium_po.pages.main_page import MainPage
E ImportError: cannot import name 'MainPage'
============================== 1 error in 0.30s ===============================
ERROR: not found: D:\python_workSpace\Appium\test_appium_po\test_case\test_xueqiu.py::TestXueqiu::test_add
(no name 'D:\python_workSpace\Appium\test_appium_po\test_case\test_xueqiu.py::TestXueqiu::test_add' in any of [])


↙↙↙阅读原文可查看相关链接,并与作者交流